List

(to be continued)

List中可以存放Tuple,如果每个Tuple的元素一样多,则我们可以使用以下的方法来遍历这个List

mylist = []
mylist.append(("peng", 20))
mylist.append(("lin", 21))

for name, age in mylist:
    print name, age

Last updated

Was this helpful?