Rumah > Artikel > pembangunan bahagian belakang > Python之List和Tuple类型
L = ['Adam', 95.5, 'Lisa', 85, 'Bart', 59] print L
L = [95.5,85,59] print L[0] print L[1] print L[2] print L[3]
L = [95.5, 85, 59] print L[-1] print L[-2] print L[-3] print L[-4]
L = ['Adam', 'Lisa', 'Bart'] L.insert(2, 'Paul') print L
L = ['Adam', 'Lisa', 'Paul', 'Bart'] L.pop(3) L.pop(2) print L
L = ['Adam', 'Lisa', 'Bart'] L[0] = 'Bart' L[-1] = 'Adam' print L
t = (0,1, 2, 3, 4, 5, 6, 7, 8, 9) print t
t = ('Adam',) print t
t = ('a', 'b', ('A', 'B')) print t
更多Python之List和Tuple类型 相关文章请关注PHP中文网!