small_Sun

关注

utf8写文件

small_Sun

关注

阅读 112

2023-04-11


CODEC='utf-8'
FILE='unicode.txt'

hello_out = u"Hello world\n"
bytes_out = hello_out.encode(CODEC)
f = open(FILE,"w")
f.write(bytes_out)
f.close()

f = open(FILE,"r")
bytes_in = f.read()
f.close()
hello_in = bytes_in.decode(CODEC)
print hello_in,

Hello world

相关推荐

分湖芝蘭

vs打开utf8编码文件

分湖芝蘭 40 0 0

精进的医生

XML UTF8

精进的医生 46 0 0

zmhc

java utf8乱码

zmhc 78 0 0

kolibreath

python 默认utf8

kolibreath 28 0 0

小桥流水2016

java 转 utf8

小桥流水2016 19 0 0

程序员知识圈

'htmlentities(): charset `utf8' not supported, assuming utf-8'

程序员知识圈 151 0 0

洲行

UnicodeDecodeError: 'utf8' codec can'

洲行 49 0 0

山竹山竹px

UTF8编码解码函数

山竹山竹px 29 0 0

心智的年轮

DELPHI MYSQL utf8 乱码

心智的年轮 65 0 0

梅梅的时光

Unicode码转UTF8

梅梅的时光 119 0 0

精彩评论(0)

0 0 举报