Self-study python-list (object) tuples tuple (object) method

Source: Internet
Author: User

Python List Method Summary
classList (object):"""list (), New empty list List (iterable), new list initialized from iterable ' s items"""    defAppend (self, p_object):#real signature unknown; restored from __doc__        """L.append (object), None--Append object to end"""        Pass    defClear (self):#real signature unknown; restored from __doc__        """l.clear (), None--Remove all items from L"""        Pass    defCopy (self):#real signature unknown; restored from __doc__        """l.copy () List--a shallow copy of L"""        return []    defCount (self, value):#real signature unknown; restored from __doc__        """L.count (value), integer--return number of occurrences of value"""        return0defExtend (self, iterable):#real signature unknown; restored from __doc__        """L.extend (iterable), None--extend list by appending elements from the iterable"""        Pass    defIndex (self, value, Start=none, Stop=none):#real signature unknown; restored from __doc__        """L.index (value, [Start, [stop]]), integer-return first index of value.        Raises valueerror if the value is not present. """        return0defInsert (self, Index, p_object):#real signature unknown; restored from __doc__        """L.insert (Index, object)--Insert object before index"""        Pass    defPop (self, index=none):#real signature unknown; restored from __doc__        """l.pop ([index]), item-Remove and return item at index (default last).        Raises indexerror If list is an empty or index is out of range. """        Pass    defRemove (self, value):#real signature unknown; restored from __doc__        """L.remove (value), None--Remove first occurrence of value.        Raises valueerror if the value is not present. """        Pass    defReverse (self):#real signature unknown; restored from __doc__        """L.reverse ()--Reverse *in place*"""        Pass    defSort (self, key=none, reverse=false):#real signature unknown; restored from __doc__        """L.sort (Key=none, Reverse=false), None--stable sort *in place*"""        Pass    def __add__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self+value."""        Pass    def __contains__(Self, *args, **kwargs):#Real Signature Unknown        """Return key in self."""        Pass    def __delitem__(Self, *args, **kwargs):#Real Signature Unknown        """Delete Self[key]."""        Pass    def __eq__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self==value."""        Pass    def __getattribute__(Self, *args, **kwargs):#Real Signature Unknown        """Return getattr (self, name)."""        Pass    def __getitem__(Self, y):#real signature unknown; restored from __doc__        """x.__getitem__ (y) <==> X[y]"""        Pass    def __ge__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self>=value."""        Pass    def __gt__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self>value."""        Pass    def __iadd__(Self, *args, **kwargs):#Real Signature Unknown        """Implement Self+=value."""        Pass    def __imul__(Self, *args, **kwargs):#Real Signature Unknown        """Implement Self*=value."""        Pass    def __init__(Self, seq= ()):#known special case of list.__init__        """list (), New empty list List (iterable), new list initialized from iterable ' s items # (c Opied from class doc)"""        Pass    def __iter__(Self, *args, **kwargs):#Real Signature Unknown        """Implement iter (self)."""        Pass    def __len__(Self, *args, **kwargs):#Real Signature Unknown        """Return len (self)."""        Pass    def __le__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self<=value."""        Pass    def __lt__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self<value."""        Pass    def __mul__(Self, *args, **kwargs):#Real Signature Unknown        """Return SELF*VALUE.N"""        Pass@staticmethod#known case of __new__    def __new__(*args, **kwargs):#Real Signature Unknown        """Create and return a new object. See Help (type) for accurate signature. """        Pass    def __ne__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self!=value."""        Pass    def __repr__(Self, *args, **kwargs):#Real Signature Unknown        """Return repr (self)."""        Pass    def __reversed__(self):#real signature unknown; restored from __doc__        """l.__reversed__ ()--return a reverse iterator over the list"""        Pass    def __rmul__(Self, *args, **kwargs):#Real Signature Unknown        """Return Self*value."""        Pass    def __setitem__(Self, *args, **kwargs):#Real Signature Unknown        """Set Self[key] to value."""        Pass    def __sizeof__(self):#real signature unknown; restored from __doc__        """l.__sizeof__ ()--size of L in memory, in bytes"""        Pass    __hash__= None
List Source

? Introduction to the list:
The O list is a sequence object that can contain any Python data information, such as strings, numbers, lists, tuples, etc.
o The data of the list is variable, we can add, modify and delete the data in the list through the object method.
O you can convert a sequence type to a list by using the list (SEQ) function
1. Append (x), appending a single object x at the end of the list, using multiple arguments causes an exception

append (self, p_object)

1.
2.
3.
4.

>>>lst=[1,2,3]
>>>relust=lst.append (4)
>>>print result
[1,2,3,4]



2.count (x), returns the number of times the object x appears in the list
3.extend (l), add the table entry in list L to the list, return none
4.Index (x), returns the index of the first list item in the list that matches object x, produces an exception if no matching element
5.insert (I,X), inserts an object x before the element indexed to I, such as List.insert (0,X) before the first item, returns none
6.pop (x), removes the table entry with index x in the list and returns the value of the table entry, and if no index is specified, POP returns the last item in the list
7.remove (x), removes the first element of the matching object x in the list, produces an exception when the element is matched, returns none
8.reverse (), reverses the order of the list elements
9.sort (), sort the list, return the None,bisect module can be used to add and delete sorted list items

Self-study python-list (object) tuples tuple (object) method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.