Python 列表元组字典t的常用方法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python 列表元组字典t的常用方法相关的知识,希望对你有一定的参考价值。

class list(object):

   """

   list() -> new empty list

   list(iterable) -> new list initialized from iterable‘s items

   """

   def append(self, p_object): # real signature unknown; restored from __doc__

       """ L.append(object) -- append object to end """

       pass

   def count(self, value): # real signature unknown; restored from __doc__

       """ L.count(value) -> integer -- return number of occurrences of value """

       return 0

   def extend(self, iterable): # real signature unknown; restored from __doc__

       """ L.extend(iterable) -- extend list by appending elements from the iterable """

       pass

   def index(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.

       """

       return 0

   def insert(self, index, p_object): # real signature unknown; restored from __doc__

       """ L.insert(index, object) -- insert object before index """

       pass

   def pop(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 empty or index is out of range.

       """

       pass

   def remove(self, value): # real signature unknown; restored from __doc__

       """

       L.remove(value) -- remove first occurrence of value.

       Raises ValueError if the value is not present.

       """

       pass

   def reverse(self): # real signature unknown; restored from __doc__

       """ L.reverse() -- reverse *IN PLACE* """

       pass

   def sort(self, cmp=None, key=None, reverse=False): # real signature unknown; restored from __doc__

       """

       L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;

       cmp(x, y) -> -1, 0, 1

       """

       pass




class tuple(object):

   """

   tuple() -> empty tuple

   tuple(iterable) -> tuple initialized from iterable‘s items

   

   If the argument is a tuple, the return value is the same object.

   """

   def count(self, value): # real signature unknown; restored from __doc__

       """ T.count(value) -> integer -- return number of occurrences of value """

       return 0

   def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__

       """

       T.index(value, [start, [stop]]) -> integer -- return first index of value.

       Raises ValueError if the value is not present.

       """

       return 0




class dict(object):

   """

   dict() -> new empty dictionary

   dict(mapping) -> new dictionary initialized from a mapping object‘s

       (key, value) pairs

   dict(iterable) -> new dictionary initialized as if via:

       d = {}

       for k, v in iterable:

           d[k] = v

   dict(**kwargs) -> new dictionary initialized with the name=value pairs

       in the keyword argument list.  For example:  dict(one=1, two=2)

   """

   def clear(self): # real signature unknown; restored from __doc__

       """ D.clear() -> None.  Remove all items from D. """

       pass

   def copy(self): # real signature unknown; restored from __doc__

       """ D.copy() -> a shallow copy of D """

       pass

   @staticmethod # known case

   def fromkeys(S, v=None): # real signature unknown; restored from __doc__

       """

       dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.

       v defaults to None.

       """

       pass

   def get(self, k, d=None): # real signature unknown; restored from __doc__

       """ D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None. """

       pass

   def has_key(self, k): # real signature unknown; restored from __doc__

       """ D.has_key(k) -> True if D has a key k, else False """

       return False

   def items(self): # real signature unknown; restored from __doc__

       """ D.items() -> list of D‘s (key, value) pairs, as 2-tuples """

       return []

   def iteritems(self): # real signature unknown; restored from __doc__

       """ D.iteritems() -> an iterator over the (key, value) items of D """

       pass

   def iterkeys(self): # real signature unknown; restored from __doc__

       """ D.iterkeys() -> an iterator over the keys of D """

       pass

   def itervalues(self): # real signature unknown; restored from __doc__

       """ D.itervalues() -> an iterator over the values of D """

       pass

   def keys(self): # real signature unknown; restored from __doc__

       """ D.keys() -> list of D‘s keys """

       return []

   def pop(self, k, d=None): # real signature unknown; restored from __doc__

       """

       D.pop(k[,d]) -> v, remove specified key and return the corresponding value.

       If key is not found, d is returned if given, otherwise KeyError is raised

       """

       pass

   def popitem(self): # real signature unknown; restored from __doc__

       """

       D.popitem() -> (k, v), remove and return some (key, value) pair as a

       2-tuple; but raise KeyError if D is empty.

       """

       pass

   def setdefault(self, k, d=None): # real signature unknown; restored from __doc__

       """ D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D """

       pass

   def update(self, E=None, **F): # known special case of dict.update

       """

       D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.

       If E present and has a .keys() method, does:     for k in E: D[k] = E[k]

       If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v

       In either case, this is followed by: for k in F: D[k] = F[k]

       """

       pass

   def values(self): # real signature unknown; restored from __doc__

       """ D.values() -> list of D‘s values """

       return []

   def viewitems(self): # real signature unknown; restored from __doc__

       """ D.viewitems() -> a set-like object providing a view on D‘s items """

       pass

   def viewkeys(self): # real signature unknown; restored from __doc__

       """ D.viewkeys() -> a set-like object providing a view on D‘s keys """

       pass

   def viewvalues(self): # real signature unknown; restored from __doc__

       """ D.viewvalues() -> an object providing a view on D‘s values """

       pass


本文出自 “zgw285763054” 博客,请务必保留此出处http://zgw285763054.blog.51cto.com/11591804/1891400

以上是关于Python 列表元组字典t的常用方法的主要内容,如果未能解决你的问题,请参考以下文章

python字典(dict)+常用方法操作+列表元组集合字典的互相转换

Python元组类型字典类型及常用操作

python 列表,字典,元组,字符串,常用函数

python中字符串列表元组字典每个常用的5个方法

Python列表元组字典和字符串的常用函数

字典元组列表常用方法