用土耳其字符写一个文件

时间:2018-10-01 22:51:39

标签: python

如何打印土耳其语?

open("save.txt", "w+").write("C:\Müzikler")
folder = open("save.txt", "r+").read()
os.listdir(folder)

输出:

FileNotFoundError: [WinError 3] The system cannot find the path specified: 
C:\xfczikler'

1 个答案:

答案 0 :(得分:0)

对于特殊字符(或您的重音符号),您需要使用utf-8进行编码。

执行以下操作:

open("save.txt", 'w+', encoding='utf-8').write("C:\Müzikler")