Python3元组、字典及函数
Python3 Python >>> tup2 = (1, 2, 3, 4, 5 ); >>> tup3 = "a","b", "c", "d"; # >>> type(tup3) # <class 'tuple'> tup1 = (); >>> tup1 = (50) >>> type(tup1) # <class 'int'> >>> tup1 = (50,) >>> type(tup1) # <class 'tuple'> len(tuple) max(tuple) min(tuple) tuple(seq) >>> list1= ['Google', 'Taobao','Runoob', 'Baidu'] >>> tuple1=tuple(list1) >>> tuple1 ('Google', 'Taobao', 'Runoob', 'Baidu') " >>> t = ('a', 'b', ['A', 'B']) >>> t[2][0] = 'X' >>> t[2][1] = 'Y' >>> t ('a', 'b', ['X', 'Y']) tuple Python3 d = {key1 : value1, key2 :value2 } d = {key1 : value1, key2 : value2 } len(d) keys() values() items():