Python
Python "Hello, World!" ""
Python
#!/usr/bin/python
print ("")
File "test.py", line 2 SyntaxError: Non-ASCII character '\xe4' in file test.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
Python ASCII
# -*- coding: UTF-8 -*- # coding=utf-8
# coding=utf-8 =
Python3.X utf-8 UTF-8
py UTF-8
SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xc4 in position 0: invalid continuation bytePycharm
- file > Settings encoding
- Editor > File encodings IDE Encoding Project Encoding utf-8
Airmin
lau***[email protected]
pycharm:
# -*- coding: UTF-8 -*-
Airmin
lau***[email protected]
wxfjf
wxf***qq.com
python2.x # -*- coding: UTF-8 -*- #coding=utf-8 windows
decode("utf-8") utf-8 encode("gbk") gbk windows
:
>>> # -*- coding: UTF-8 -*- >>> s=" " >>> print s.decode("utf-8").encode("gbk")windows gbk
chcp
"936" "gbk"
"65001" "utf-8"
wxfjf
wxf***qq.com
tjy***[email protected]
Eclipse python :
python utf-8 utf-8
1Eclipse Window->Preferences:
Eclipse eclipse.ini -Dfile.encoding=UTF-8
2 notepad++ test.py ANSI
UTF-8
tjy***[email protected]