Python List Methods
about list that Python bulit-in types
List
-
methods
del list[:] list.reverse() list.append(x) list.extend(x) list.insert(i, x) list.remove(x) list.pop(i) list.sort() list.reverse() list.copy() #SHALLOW, deep copy -> deepcopy.copy(list) or use for loop list.clear() #deque is useful in timecomplexity import deque deque.appendleft(x) # list O(N), deque O(1) deque.popleft()
Leave a comment