Encoding for Multilingual .py Files

前端 未结 2 608
礼貌的吻别
礼貌的吻别 2021-02-14 01:20

I am writing a .py file that contains strings from multiple charactersets, including English, Spanish, and Russian. For example, I have something like:

string_en         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-14 02:08

    You have to add # -*- coding: XXXX -*- in the beginning of file, replacing the XXXX with the encoding your editor uses to save your source file;

    Which editor are you using? Can you check on the editor settings which encoding is being used to save the data?

提交回复
热议问题