SyntaxError: Non-ASCII character '\xe7' in file thirdDemo.python on line 2

郭恩洲_OSC博客 发布于 2015/06/09 18:23
阅读 346
收藏 0

【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”

  File "thirdDemo.python", line 2
SyntaxError: Non-ASCII character '\xe7' in file thirdDemo.python on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
加载中
0
郭恩洲_OSC博客
郭恩洲_OSC博客
在第一行增加:#-*- coding: UTF-8 -*- 。
0
郭恩洲_OSC博客
郭恩洲_OSC博客
  1 #-*- coding: UTF-8 -*-
  2 
  3 #用测试输入数据来处理错误
  4 while True:
  5  reply = raw_input('Enter text:')
  6  if reply == 'stop':
  7   break
  8  elif not reply.isdigit():
  9   print('bad!' * 8)
 10  else:
 11   print(int(reply) ** 2)
 12 print('Bye')
0
b
bavol
字符编码问题
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部