-->

Wednesday, July 10, 2019

Python Basic Data Structures and Common Commands Cheatsheet


Lists
[]
list
append, extend, pop, index
Tuples (immutable)
() or {},
tuple

Sets
{'',}


Dictionary
{}
dict


List | Common Commands:

Append | For adding a single element. If you give it a list, it'll add a list of a list
Extend | for merging a lot of elements
Clear | for clearing the element
Index | for searching the position of an item, first occurrence.
Remove | for removing a specific item, first occurrence
pop | for removing a single item from at a INDEX position (AND returning it if need be). 
Copy | For creating a new object. Anyway else will just reference the old object
Reverse | Flips things over
Count | Built in Frequency Counter


Examples




No comments:

Post a Comment