Python, how to print Japanese, Korean, Chinese strings

前端 未结 5 1919
情书的邮戳
情书的邮戳 2021-01-13 12:55

In Python, for Japanese, Chinese, and Korean,Python can not print the correct strings, for example hello in Japanese, Korean and Chinese are:

こん         


        
5条回答
  •  轮回少年
    2021-01-13 13:46

    Try this:

    import codecs
    
    fp = codecs.open('test.txt', encoding='utf-8')
    
    for line in fp:
        print line
    

提交回复
热议问题