本文共 1301 字,大约阅读时间需要 4 分钟。
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello['h', 'e', 'l', 'l', 'o']>>> hello.append('world')>>> hello['h', 'e', 'l', 'l', 'o', 'world']
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello.count('l')2
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> world = ['w', 'o', 'r', 'l', 'd']>>> hello.extend(world)>>> hello['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd']
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello.index('l')2
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello.insert(2, 'world')>>> hello['h', 'e', 'world', 'l', 'l', 'o']
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello.pop()'o'>>> hello['h', 'e', 'l', 'l']>>> hello.pop(1)'e'>>> hello['h', 'l', 'l']
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello.remove('l')>>> hello['h', 'e', 'l', 'o']
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello.sort()>>> hello['e', 'h', 'l', 'l', 'o']>>> hello.sort(reverse=True)>>> hello['o', 'l', 'l', 'h', 'e']
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> hello.clear()>>> hello[]
# Python3>>> hello = ['h', 'e', 'l', 'l', 'o']>>> aa = hello.copy()>>> aa['h', 'e', 'l', 'l', 'o']
转载地址:http://ojjqi.baihongyu.com/