违法℃玩家 发表于 2017-4-20 12:12:02

你好,Python

  Python中有中文,报错
  试了下

s = '你好,Python'
print s

  运行报错
  File "testChinese.py", line 1
  SyntaxError: Non-ASCII character '\xc4' in file testChinese.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html
  for details
  在代码前指定编码方式,

# coding=UTF-8
s = '你好,Python'
print s

  OK!!
页: [1]
查看完整版本: 你好,Python