这和用list来实现有什么区别吗?有些疑惑
weekdays = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
x=input('shusru:')
if x in weekdays:
print 'input ok'
else:
print 'input error'
weekdays = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
x=input('shusru:')
if x in weekdays:
print 'input ok'
else:
print 'input error'
2017-07-26
weekdays = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'] x=input('shusru:') if x in weekdays: print 'input ok' else: print 'input error'#这个好像只能判断x months = set(['Jan','Feb','Mar','Apr','May','Jun','Jul','Agu','Sep','Oct','Nov','Dec']) x1 = 'Feb' x2 = 'Sun' if x1 in months: print 'x1: ok' else: print 'x1: error' if x2 in months: print 'x2: ok' else: print 'x2: error'#而是用set的话,同时判断了x1,x2..
举报