Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #69997 > unrolled thread
| Started by | length power <elearn2014@gmail.com> |
|---|---|
| First post | 2014-04-10 09:54 +0800 |
| Last post | 2014-04-10 09:54 +0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
How to display chinese character in 65001 in pytohn? length power <elearn2014@gmail.com> - 2014-04-10 09:54 +0800
| From | length power <elearn2014@gmail.com> |
|---|---|
| Date | 2014-04-10 09:54 +0800 |
| Subject | How to display chinese character in 65001 in pytohn? |
| Message-ID | <mailman.9104.1397094885.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
I am in win7 +python3.3.
import os
os.system("chcp 936")
fh=open("test.ch","w",encoding="utf-8")
fh.write("你")
fh.close()
os.system("chcp 65001")
fh=open("test.ch","r",encoding="utf-8").read()
print(fh)
Äã
>>> print(fh.encode("utf-8"))
b'\xe4\xbd\xa0'
How can i display the chinese character `你` in 65001?
Back to top | Article view | comp.lang.python
csiph-web