There are many data types in Python. Today Xiaoqian will introduce three of them, lists, tuples, dictionaries and their concepts and usage. You will understand after reading them.
1. List
First of all, List is included with [], and each element is separated by a (comma). Any data type can be nested in List, and data types can be nested within each other (except for set), such as:
the value of a list
List modification
List delete
List insertion
List query
List reverse
List sort, maximum (small) value
Conversion between lists and strings
Two, tuple
The tuple is an immutable type, the value cannot be changed according to the index, and cannot be added or deleted. The tuple is included with (), such as:
Tuples can also be indexed, sliced, and traversed. I will not demonstrate here.
There are two methods:
Tips:
Tuples are also parentheses, which look the same as the method. In order to facilitate the distinction and make it more intuitive, we generally add a comma after it. This is a good specification..., such as: tu = (1,2,3,)
Three, dictionary
The dictionary uses {} to include key-value pairs composed of key and value. The dictionary is an unordered list of sets. The dictionary cannot be used as the key value. The key value can only be unique. The dictionary can still nest other data types, such as:
Value
Traverse If
you want to know more about Python technology, welcome to follow me!