how to print chinese word in my code.. using python

前端 未结 6 1272
别那么骄傲
别那么骄傲 2020-11-30 05:22

This is my code:

print \'哈哈\'.decode(\'gb2312\').encode(\'utf-8\')

...and it prints:

SyntaxError: Non-ASCII character \'\\x         


        
6条回答
  •  长情又很酷
    2020-11-30 05:57

    You should check you terminal character encoding.

    On my terminal, first i set character encoding to utf-8, everything is alright.

    When i set it to GBK, the result is '鍝堝搱'.

提交回复
热议问题