def testgen(index):
weekdays = ['sun','mon','tue','wed','thu','fri','sat']
yield weekdays[index]...)
# 输出: sun mon tue wed thu fri sat
把一个列表变成一个元组。...)
# 输出: ('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')
把一个列表变成一个集合。...)
# 输出: set(['wed', 'sun', 'thu', 'tue', 'mon', 'fri', 'sat'])
将列表变成字典。...weekdays = ['sun','mon','tue','wed','thu','fri']
listAsDict = dict(zip(weekdays[0::2], weekdays[1::2]