This is the content of the December plan, beginning in January 2018 ~
If there is any mistake, please ask for it ~
Previous content
Http://www.cnblogs.com/yinghualuowu/p/7742663.html
Print usage
No matter what type you can output directly (data type will be in the next article)
Like what
1X=12 Print(x)3s="Hello World"4 Print(s)5list_a=[1,2,'a', []]6 Print(list_a)7dict_a={'a': 1,'b': 2}8 Print(dict_a)
1Hello world['a', [1, 2]]{'a' ' b ': 2}
Formatted output
Like printf, there's%d,%s.
Like what
1 s="hello"2 a=20183print(" %s%d" % (s,a))
Hello 2018
1pi=3.14159262 Print("%f"%PI)3 Print("%.3f"%PI)4num=1234567895 Print(num)6 Print("%10.3f"%PI)#field width 10, accuracy 3 num for comparison7 Print("%-10.3f"%PI)8 Print("%010.3f"%PI)#fill blanks with 0
3.1415933.142123456789 3.1423.142 000003.142
Print default line break
Oh, don't want to change the line ...
1 Print ")
A variety of very lazy operation
Some operations on strings
1x="Hello"2y=" World"3 Print(x+y)#Stitching4 Print(x*2)5 Print(" A"+" the")6 Print(" A"* *)
Helloworldhellohello12341212
Arithmetic is also possible.
It's almost there.
Python Foundation One