This is the content of the December plan, beginning in January 2018 ~
If there is any mistake, please ask for it ~
Python Print Function One
Variable assignment in Python does not require a type declaration, okay, well, that's OK.
We can also take a look at the type
1 num=1.2332 str="1.233"3print(type (num)) 4print(Type (str))
<class'float'><class'str'>
Data Type- string
Single quote, double quotation mark usage same
1 str="1.233"2 string='1.233'3 Print (str) 4 Print (string)
1.2331.233
A string that represents multiple lines in three quotation marks
1 str="ASDASD2asdasdasd3asdasdasd4 Adas " " 5 Print (str)
Asdasdasdasdasdasdasdasdadas
There are all kinds of escapes ... I think it's OK to remember a little bit of the usual, and then look it up when you use it.
| Escape Character |
Description |
| \ (at end of line) |
Line continuation character |
| \\ |
Backslash symbol |
| \‘ |
Single quotation marks |
| \" |
Double quotes |
and its operators.
+,* all said, let's take a look at [],in,not in
1 str="helloworld"2print(str[1])3 Print(Str[1:4])# interval is left closed right open, note negative number is right to left 4print(str[:5]) 5 Print (str[4:])
Eellhellooworld
1 str="helloworld"2print("H" inch str) 3 Print ("H" not in str)
TrueFalse
R or R, original string-original string: All strings are used directly as literal meanings, and no special or non-printable characters are escaped. Escape can't remember, you can use this.
1 str=r"D:\eclipse\readme"2print(str)
D:\eclipse\readme
Finally it's internal function, play it by yourself ~ There will be a summary later.
Python variable data type-string two