python --list


list:


class list(object):(list类中提供的方法)
"""
list() -> new empty list
list(iterable) -> new list initialized from iterable's items
"""
1、def append(self, p_object): # real signature unknown; restored from __doc__(追加)(对象。。方法。。:def对象调用append方法)
""" L.append(object) -> None -- append object to end """
pass

2、def clear(self): # real signature unknown; restored from __doc__
""" L.clear() -> None -- remove all items from L """
pass

3、def copy(self): # real signature unknown; restored from __doc__
""" L.copy() -> list -- a shallow copy of L """
return []

4、def count(self, value): # real signature unknown; restored from __doc__
""" L.count(value) -> integer -- return number of occurrences of value """
return 0

5、def extend(self, iterable): # real signature unknown; restored from __doc__
""" L.extend(iterable) -> None -- extend list by appending elements from the iterable """
pass

6、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

6、def insert(self, index, p_object): # real signature unknown; restored from __doc__
""" L.insert(index, object) -- insert object before index """
pass

7. def pop(self, index=None): # real signature unknown; restored from __doc__ (delete the value specified in the list, the left first, and output the deleted value)
"""
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

8、def remove(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

9. def reverse(self): # real signature unknown; restored from __doc__ (reverse the current list)
""" L.reverse() -- reverse *IN PLACE* """
pass

10. def sort(self, key=None, reverse=False): # real signature unknown; restored from __doc__ (list sort)
""" L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE* """
pass



addition: String creation cannot be modified
List is ordered and can be modified


shudian = ["Li Qiang","Li Chengrui","Xiang Yumao","Zhao Yuwei"]
modian = ["Zhao Yuwei ","Li Qiang",]

all = []
for name in shudian :
if name in modian:
all.append(name)
print(all) #The
first list and the second list do a relational operation to find the common part of the two

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324936094&siteId=291194637