How to print/store non-ASCII characters (unicode?)

前端 未结 2 750
时光取名叫无心
时光取名叫无心 2021-01-24 04:23

I am reading in a large file of musicians. Many of these artists have strange characters in their names, as they may be from Germany or some other country with non-ASCII charac

相关标签:
2条回答
  • 2021-01-24 04:54

    Let me help you help yourself.

    First, go read Joel's The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!).

    Then, it greatly depends whether you use Python 2 or 3:

    • Python 2 Unicode HOWTO
    • Python 3 Unicode HOWTO
    0 讨论(0)
  • just include these two line at the top of your code

    1. #!/usr/local/bin/python
    2. # coding: latin-1

    go to this link for further details

    0 讨论(0)
提交回复
热议问题