Python, Unicode, and the Windows console

前端 未结 13 2149
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 04:38

When I try to print a Unicode string in a Windows console, I get a UnicodeEncodeError: \'charmap\' codec can\'t encode character .... error. I assume this is b

13条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-21 05:09

    Just enter this code in command line before executing python script:

    chcp 65001 & set PYTHONIOENCODING=utf-8
    

提交回复
热议问题