序列类型包括:list, tuple, range, 补充:字符串类型,二进制数据类型(binary data)
其中包括可变序列类型:如list,不可变序列类型: 如字符串类型,tuple类型
lst = [0 for i in range(10)]
lst
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
lst[:5] = range(1,6)
lst
[1, 2, 3, 4, 5, 0, 0, 0, 0, 0]
lst *= 2
lst
[1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0]
lst.pop(0)
lst
[2, 3, 4, 5, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0]
[func for func in dir(lst) if not func.startswith("__")]
['append',
'clear',
'copy',
'count',
'extend',
'index',
'insert',
'pop',
'remove',
'reverse',
'sort']
[func for func in dir("str") if not func.startswith("__")]
['capitalize',
'casefold',
'center',
'count',
'encode',
'endswith',
'expandtabs',
'find',
'format',
'format_map',
'index',
'isalnum',
'isalpha',
'isascii',
'isdecimal',
'isdigit',
'isidentifier',
'islower',
'isnumeric',
'isprintable',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'replace',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill']
原文:https://www.cnblogs.com/YajunRan/p/11521941.html