MindMap Gallery python data structure
This picture is about the relevant definitions of the basic data structures of list (list), tuple (tuple), str (string), dict (dictionary), and set (set) in python, as well as common operation knowledge.
Edited at 2023-08-19 19:25:44Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
python data structure
list(list)
Definition: A data container that is ordered, repeatable, modifiable, and can accommodate multiple different data types
Definition of empty list
variable name = []
variable name = list()
List search: index (list element)
Remove elements from the list: list[subscript]
Modify elements in the list: list[subscript]=value
Insert element: list.insert(subscript, element)
Append elements:
list.append(element)
list.extend(other data containers)
Delete elements:
del list[subscript]
list.pop(subscript)
clear the list
list.clear()
Count the number of an element in the list: list.count(element)
Count how many elements there are in the list: len(list)
tuple(tuple)
Definition: An ordered, repeatable, multiple data type, unmodifiable data container that remains unchanged once defined
Definition of empty tuple
variable name = ()
variable name = tuple()
Find elements in a tuple: index(element)
Count the number of elements in a tuple: tuple.count(element)
Count the number of elements in a tuple: len(tuple)
str(string)
Definition: Supports subscript index and cannot be modified, but the corresponding position can be replaced according to the subscript. After the replacement, a new string is obtained instead of a modification of the string.
Replacement of string: str.replace(string1, string2) Replace string1 with string2
String splitting: str.split (the splitting standard for splitting, the default is to split according to spaces)
String shaping operation: str.strip() removes the leading and trailing spaces and newline characters from the string
dict(dictionary)
Definition: Store key-value pairs. Each key-value pair is separated by commas. Key and value can be any type of data (key cannot be a dictionary). Key cannot be repeated. Repeating will overwrite the original data.
Define empty dictionary
variable name = {}
variable name = dict()
Dictionary acquisition: dict["key"] Dictionaries cannot use subscript indexes
Add new element (update element): dict[key]=value
Delete elements: dict.pop(key)
Clear the dictionary: dict.clear()
Get all keys in the dictionary: dict.keys()
set(set)
Definition: Unordered, non-repeating, modifiable, data container that supports multiple data types. Because it is unordered, it does not support subscript index access to elements in the collection.
Add elements: set.add(element)
Remove elements: set.remove(element)
Randomly remove elements: set.pop()
Clear the collection: set.clean()
Take the difference between two sets: set 1.difference(set 2) to get a new set, set 1 and set 2 remain unchanged
Eliminate difference sets: Set 1.difference_update (set 2) In set 1, delete the same elements as set 2. Set 1 will be modified, and set 2 will remain unchanged.
Define an empty collection: variable name = set()