标签:
>>> mylist = [‘a‘, ‘b‘] >>> mylist.append([‘c‘,‘d‘]) >>> mylist [‘a‘, ‘b‘, [‘c‘, ‘d‘]] >>> mylist.extend([‘e‘,‘f‘]) >>> mylist [‘a‘, ‘b‘, [‘c‘, ‘d‘], ‘e‘, ‘f‘]
>>> mylist.index(‘b‘) 1 >>> mylist.index([‘c‘,‘d‘]) 2
List运算中的 + 和 * >>> mylist [‘a‘, ‘b‘, [‘c‘, ‘d‘], ‘e‘, ‘f‘] >>> mylist = mylist + [‘g‘,‘h‘] >>> mylist [‘a‘, ‘b‘, [‘c‘, ‘d‘], ‘e‘, ‘f‘, ‘g‘, ‘h‘] >>> mylist += [‘i‘] >>> mylist [‘a‘, ‘b‘, [‘c‘, ‘d‘], ‘e‘, ‘f‘, ‘g‘, ‘h‘, ‘i‘] >>> yourlist = [‘1‘,‘2‘,‘3‘] >>> yourlist = yourlist * 3 >>> yourlist [‘1‘, ‘2‘, ‘3‘, ‘1‘, ‘2‘, ‘3‘, ‘1‘, ‘2‘, ‘3‘] >>>
何谓 Python 中的 True:
标签:
原文地址:http://www.cnblogs.com/haohonglee/p/4457860.html