以下是需要做类型转换吗
课程里面的用input的例子运行不了
# -*- coding: utf-8 -*-
weekdays = set(['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'])
# x = '???' # 用户输入的字符串
x = input("输入:")
if x in weekdays:
print 'input ok'
else:
print 'input error'
错误信息:
File "C:/Users/YCKJ1005/PycharmProjects/Demo0821/try.py", line 4, in <module>
x = input("输入:")
File "<string>", line 1, in <module>
NameError: name 'MON' is not defined