python学习第一天

使用pycharm时候,python 2.x 版本无法print中文时候报错

需要在首行添加此注释:

# -*- coding: UTF-8 -*-

报错代码:

D:\Python27\python.exe F:/烟台现场维护-1/张栋/C#笔记/python/字符串格式化.py
  File "F:/��̨�ֳ�ά��-1/�Ŷ�/C#�ʼ�/python/�ַ�����ʽ��.py", line 42
SyntaxError: Non-ASCII character '\xe4' in file F:/��̨�ֳ�ά��-1/�Ŷ�/C#�ʼ�/python/�ַ�����ʽ��.py on line 42, but no encoding declared; 

see http://python.org/dev/peps/pep-0263/ for details


进程已结束,退出代码1

你可能感兴趣的:(学习)