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:44One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
Project management is the process of applying specialized knowledge, skills, tools, and methods to project activities so that the project can achieve or exceed the set needs and expectations within the constraints of limited resources. This diagram provides a comprehensive overview of the 8 components of the project management process and can be used as a generic template for direct application.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
One Hundred Years of Solitude is the masterpiece of Gabriel Garcia Marquez. Reading this book begins with making sense of the characters' relationships, which are centered on the Buendía family and tells the story of the family's prosperity and decline, internal relationships and political struggles, self-mixing and rebirth over the course of a hundred years.
Project management is the process of applying specialized knowledge, skills, tools, and methods to project activities so that the project can achieve or exceed the set needs and expectations within the constraints of limited resources. This diagram provides a comprehensive overview of the 8 components of the project management process and can be used as a generic template for direct application.
No relevant template
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()