close
test = [1,2,3,4,5,6] result = map(lambda x:x+0.5 if x!=3 else 99,test) print(list(result)) names = ["A", "B", "C"] values = [11, 23, 46] # 使用 zip 同時迭代兩個 List for x, y in zip(names, values): print(x, y) ''' A 11 B 23 C 46 ''' for index,content in enumerate(names): print(index) ''' 0 A 1 B 2 C ''' print("aaaa %s and %s"%("123","hhh")) # aaaa 123 and hhh print("aaa{} {}".format("hello", "world") ) # aaahello world
全站熱搜