Number and string
(1) Number
There are 5 types of Python in the number, including signed integer (int), long Integer (long), float (float), Boolean (bool), complex Type (COM plex).
eg:0, 1,-1, 1009, -290 and so on are all int types.
eg:87887l, -90990l, 234567l and so on are all long types.
eg:2.7788, 3.277, 8.88 and so on are all float types.
There are only two bool types: one is true and the other is false.
RG:4+2J, -9+20j, 56+7j This type belongs to the plural type.
(2) string
The character set quoted in Python is called a string, such as: ' Hello ', ' m y Python ', ' 2+3 ', and so on.
The quotation marks used in a string in Python can be single quotes, double quotes, and three quotation marks. "" and "the Same" "" "preserve the format
In a string, if you want to output a special symbol, you use the escape \ Character
Line break in string to use \ n
When it comes to strings, we say slices.
In number L=list (range (10))
The element in L is 0-9 usage: l[n1:n2:n3]
N1 represents the Start element subscript
N2 represents the End element subscript
The N3 represents the slice interval and the slice direction, and the default value is 1 L each element has a positive or negative subscript
Eg:l[0] and L[-10] refer to the same element that is 0 of the data type is also applicable
2. Collection data types
list, tuple, dictionary
There are several types of data that can be stored in memory.
For example, a person's name can be stored in characters, age can be stored in numbers, hobbies can be used to store the collection and so on.
Python has five standard data types:
Numbers (digital)
String (String)
List (lists)
Tuple (tuple)
Dictionary (dictionary)
Data types that belong to a collection type have lists, tuples, and dictionaries .
list [] with additions and deletions function
Tuple () only check the function
The dictionary {} has Key,value
3. Identifiers
The naming of identifiers in Python is regular. An identifier that can be used, named by the correct naming rule, is called a valid identifier, otherwise an identifier that cannot be used is called an invalid identifier. Valid identifiers are named with the following specifications: the first character of an identifier must be only a letter or an underscore, the first character cannot appear as a number or another character, and the other part can be a letter or an underscore or a number, except the first character, and the identifier is case sensitive.
Python Two second learning two things to learn
Set Set
#a = set ()
#& intersection
#| and set
#-difference Set
# new = set (a)
#去除重复的
本人视频网站:www.ldxzs.top无任何广告 大家没事了 可以去踩一下 看看电影和连续剧也有各大卫视直播 还可以下载app版 有多种小工具
Python Two secondary learning (data type, identifier)