Python String Comparison--Problems With Special/Unicode Characters

后端 未结 4 1467
太阳男子
太阳男子 2021-02-04 20:57

I\'m writing a Python script to process some music data. It\'s supposed to merge two separate databases by comparing their entries and matching them up. It\'s almost working, bu

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-04 21:35

    To find out whether YOU (not it) are storing your strings as str objects or unicode objects, print type(your_string).

    You can use print repr(your_string) to show yourself (and us) unambiguously what is in your string.

    By the way, exactly what version of Python are you using, on what OS? If Python 3.x, use ascii() instead of repr().

提交回复
热议问题