Python String Comparison--Problems With Special/Unicode Characters

后端 未结 4 1475
太阳男子
太阳男子 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:52

    You might need to preprocess the databases and convert everything into UTF-8. My guess is that you've got Latin-1 accented characters in some entries.


    As to your question, the only way to know for sure is to look. Have your script spit out those that don't compare, and look up the character codes. Or just try string.decode('latin1').encode('utf8') and see what happens.

提交回复
热议问题