发现加了# -*- coding:utf-8 -*-这句代码运行还是会报错,为什么呢??
1、python3的话不用加 # -*- coding:utf-8 -*-
2、.py文件要存成utf8编码方式的,可用编辑器的另存为utf8编码文件的功能
如下:
#!/usr/bin/python # -*- coding: utf-8 -*- print('中文')