码迷,mamicode.com
首页 > 编程语言 > 详细

Python列表操作

时间:2018-01-02 21:24:52      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:__iter__   efault   val   ini   tin   操作   nta   dex   int   

自带帮助文档:

  1 >>> help(list)
  2 Help on class list in module builtins:
  3 
  4 class list(object)
  5  |  list() -> new empty list
  6  |  list(iterable) -> new list initialized from iterables items
  7  |  
  8  |  Methods defined here:
  9  |  
 10  |  __add__(self, value, /)
 11  |      Return self+value.
 12  |  
 13  |  __contains__(self, key, /)
 14  |      Return key in self.
 15  |  
 16  |  __delitem__(self, key, /)
 17  |      Delete self[key].
 18  |  
 19  |  __eq__(self, value, /)
 20  |      Return self==value.
 21  |  
 22  |  __ge__(self, value, /)
 23  |      Return self>=value.
 24  |  
 25  |  __getattribute__(self, name, /)
 26  |      Return getattr(self, name).
 27  |  
 28  |  __getitem__(...)
 29  |      x.__getitem__(y) <==> x[y]
 30  |  
 31  |  __gt__(self, value, /)
 32  |      Return self>value.
 33  |  
 34  |  __iadd__(self, value, /)
 35  |      Implement self+=value.
 36  |  
 37  |  __imul__(self, value, /)
 38  |      Implement self*=value.
 39  |  
 40  |  __init__(self, /, *args, **kwargs)
 41  |      Initialize self.  See help(type(self)) for accurate signature.
 42  |  
 43  |  __iter__(self, /)
 44  |      Implement iter(self).
 45  |  
 46  |  __le__(self, value, /)
 47  |      Return self<=value.
 48  |  
 49  |  __len__(self, /)
 50  |      Return len(self).
 51  |  
 52  |  __lt__(self, value, /)
 53  |      Return self<value.
 54  |  
 55  |  __mul__(self, value, /)
 56  |      Return self*value.n
 57  |  
 58  |  __ne__(self, value, /)
 59  |      Return self!=value.
 60  |  
 61  |  __new__(*args, **kwargs) from builtins.type
 62  |      Create and return a new object.  See help(type) for accurate signature.
 63  |  
 64  |  __repr__(self, /)
 65  |      Return repr(self).
 66  |  
 67  |  __reversed__(...)
 68  |      L.__reversed__() -- return a reverse iterator over the list
 69  |  
 70  |  __rmul__(self, value, /)
 71  |      Return self*value.
 72  |  
 73  |  __setitem__(self, key, value, /)
 74  |      Set self[key] to value.
 75  |  
 76  |  __sizeof__(...)
 77  |      L.__sizeof__() -- size of L in memory, in bytes
 78  |  
 79  |  append(...)
 80  |      L.append(object) -> None -- append object to end
 81  |  
 82  |  clear(...)
 83  |      L.clear() -> None -- remove all items from L
 84  |  
 85  |  copy(...)
 86  |      L.copy() -> list -- a shallow copy of L
 87  |  
 88  |  count(...)
 89  |      L.count(value) -> integer -- return number of occurrences of value
 90  |  
 91  |  extend(...)
 92  |      L.extend(iterable) -> None -- extend list by appending elements from the iterable
 93  |  
 94  |  index(...)
 95  |      L.index(value, [start, [stop]]) -> integer -- return first index of value.
 96  |      Raises ValueError if the value is not present.
 97  |  
 98  |  insert(...)
 99  |      L.insert(index, object) -- insert object before index
100  |  
101  |  pop(...)
102  |      L.pop([index]) -> item -- remove and return item at index (default last).
103  |      Raises IndexError if list is empty or index is out of range.
104  |  
105  |  remove(...)
106  |      L.remove(value) -> None -- remove first occurrence of value.
107  |      Raises ValueError if the value is not present.
108  |  
109  |  reverse(...)
110  |      L.reverse() -- reverse *IN PLACE*
111  |  
112  |  sort(...)
113  |      L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE*
114  |  
115  |  ----------------------------------------------------------------------
116  |  Data and other attributes defined here:
117  |  
118  |  __hash__ = None
119 
120 >>> 

 

Python列表操作

标签:__iter__   efault   val   ini   tin   操作   nta   dex   int   

原文地址:https://www.cnblogs.com/huahuayu/p/8178918.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!