标签:size sed art repr set att start value __new__
>>>list=[‘a‘,1,‘1‘]
>>> dir(list)
[‘__add__‘, ‘__class__‘, ‘__contains__‘, ‘__delattr__‘, ‘__delitem__‘, ‘__dir__‘, ‘__doc__‘, ‘__eq__‘, ‘__format__‘, ‘__ge__‘, ‘__getattribute__‘, ‘__getitem__‘, ‘__gt__‘, ‘__hash__‘, ‘__iadd__‘, ‘__imul__‘, ‘__init__‘, ‘__init_subclass__‘, ‘__iter__‘, ‘__le__‘, ‘__len__‘, ‘__lt__‘, ‘__mul__‘, ‘__ne__‘, ‘__new__‘, ‘__reduce__‘, ‘__reduce_ex__‘, ‘__repr__‘, ‘__reversed__‘, ‘__rmul__‘, ‘__setattr__‘, ‘__setitem__‘, ‘__sizeof__‘, ‘__str__‘, ‘__subclasshook__‘, ‘append‘, ‘clear‘, ‘copy‘, ‘count‘, ‘extend‘, ‘index‘, ‘insert‘, ‘pop‘, ‘remove‘, ‘reverse‘, ‘sort‘]
‘append‘, ‘clear‘, ‘copy‘, ‘count‘, ‘extend‘, ‘index‘, ‘insert‘, ‘pop‘, ‘remove‘, ‘reverse‘, ‘sort‘]
“追加”、“清除”、“复制”、“计数”、“扩展”、“索引”、“插入”、“弹出”、“删除”、“反向”、“排序”。
append(self, p_object):
>>> list=[1]
>>> list.append(2)
>>> list
[1, 2]
>>>
clear(self):
>>> list=[‘a‘,‘b‘]
>>> list.clear()
>>> list
[]
>>>
copy(self):
>>> list=[1]
>>> list1=list.copy()
>>> list1
[1]
>>>
count(self, value):
>>> list=[1,2,3,4,5,1]
>>> list.count(1)
2
>>>
extend(self, iterable):
>>> list=[1,2,3]
>>> list.extend({1:2})
>>> list
[1, 2, 3, 1]
>>>
index(self, value, start=None, stop=None):
>>> list=[1,2,3,2]
>>> list.index(2)
1
>>>
没有该元素则报错
insert(self, index, p_object):
>>> list=[1,2,3]
>>> list.insert(3,5)
>>> list
[1, 2, 3, 5]
>>>
pop(self, index=None):
>>> list=[1,2,3]
>>> list.pop(0)
1
>>> list
[2,3]
>>> list=[1,2,3]
>>> list.pop()
3
>>> list
[1, 2]
remove(self, value):
>>> list=[1,2,3]
>>> list.remove(1)
>>> list
[2, 3]
>>>
reverse(self):
>>> list=[1,3,2,3]
>>> list.reverse()
>>> list
[3, 2, 3, 1]
>>>
sort(self, key=None, reverse=False):
>>> list=[1,3,2,3]
>>> list.sort()
>>> list
[1, 2, 3, 3]
>>>
list=[1,3,2,3]
list.sort()
print(list)
[1, 2, 3, 3]
标签:size sed art repr set att start value __new__
原文地址:http://www.cnblogs.com/wmxuan/p/7496523.html