上传者: 38727453 
                                    |
                                    上传时间: 2022-04-14 16:24:20
                                    |
                                    文件大小: 47KB
                                    |
                                    文件类型: PDF
                                
                            
                                
                            
                                在代码文件中定义中文时,经常会遇到问题,要么编码错误,要么是无法正常打印显示。
例如,dict_chinese.py:
#!/usr/bin/python
a={'name': 'fengshou'}
b={'name': "丰收"}
print "a=", a
print "b=", b
问题1
执行,查看结果
$ python dict_chinese.py
 File "dict_chinese.py", line 5
SyntaxError: Non-ASCII character '\xe4' in file dict_chinese.py on line 5, but no