Variables in Python do not need to be declared. Each variable must be assigned before it is used, and the variable will not be created until the variable is assigned.
In Python, a variable is a variable, a memory address pointer, which has no type, and what we call "type" is the type of object in memory that the variable refers to. Similar to other reference types in Java, C.
There are six standard data types in the Python3:
Strings (String)
Boolean Type (Boolean)
Integers (integer)
Floating point (float)
Number (Digit)
Listing (list)
Tuple (tuple)
Collection (sets)
Dictionary (Dictionary)
Dates (date)
One, string
The string str in Python is enclosed in single quotation marks (') or double quotation marks (""), and the special characters are escaped with a backslash (\).
' Yes, he doesn\ ' t ' Print (S, type (s), Len (s)) Yes, he doesn ' 'str'>
If you do not want \ To escape, you can precede the string with R or R to indicate the original string:
Print ('C:\some\name') C:\someame Print (R'C:\some\name') C:\some\name
In addition, \ can be used as the red continuation character, indicating that the next line is also the continuation of the previous line. You can also use the "..." or "" ... "" "across multiple lines.
Strings can be concatenated with the + runner or repeated with the * operator:
Note: The use of formatted strings is recommended when the + connection string is not efficient when you re-open memory each time a connection is over and the connection is too high.
>>> S1 ='We'>>> s2 =' is'>>> s3 ='Go'>>>Print(S1 +' '+ s2 +' '+S3) We Are Go>>>>>>Print("%s %s%s"%(S1, S2, S3)) We Are Go>>>>>>Print('Str'+'ing','*'*10) String**********
Python Basic data type