Python 3.0 中取消了 Unicode对象只保留了str,在命令行下输出中文也有所不同。
运行环境Windows XP ,Python 3.0 a1
初始代码:
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
结果如下:
K:/work/stockget>python test1.py
File "test1.py", line 1
SyntaxError: Non-UTF-8 code starting with '/xd6' in file test1.py on line 1, but
no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
修改代码为:
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
结果如下
K:/work/stockget>python test1.py
中国
附运行结果截图: