分别定义字符串,列表,元组,字典,集合,并进行遍历
str=‘China‘ for i in str: print(i) s=[‘C‘,‘h‘,‘i‘,‘n‘,‘a‘,68] for i in s: print(i) tup=(‘china‘,‘chinese‘,1949,2018) for i in range(len(tup)): print(tup[i]) d={‘c‘:2,‘h‘:3,‘i‘:4} for k,v in d.items(): print(k,v)
总结列表,元组,字典,集合的联系与区别