Three quotation marks
1, three quotation marks: in the program I use # to make a single-line comment, you can use three quotation marks can be a long line of comments.
Three quotation marks can contain multiple lines of string, and often appear in the next line of function declaration, to annotate function, the difference is that this annotation as a default property of the function, can be accessed by the name of the functions. __doc__
2, three-quote formatted output: When printing a string with print, the three quotation marks contain multiple lines of string, the original format output
In [2]: Print "" "...: Hello world ...: My name is Dayun ...: I love you ...:" "" Hello World My Nam E is Dayuni love you
Comma
1. When printing string variables
In [3]: name = ' Dayun ' in [4]: print ' My name is ', Namemy name is Dayun
Of course we can also print with formatted output
In [5]: print ' My name is%s '%namemy name is Dayun
2, the print is appended with a comma (comma), so that print will not output a new line character and end the line to go to the next line.
Name = "Dayun" age = print "My name was%s"% name, print "I ' m%d years of age"% age
Operation Result:
~ Python test.py My name is Dayun I ' m, years of age
Two print printed results on the same line.
This article is from the "Xiaoliuer" blog, make sure to keep this source http://xiaoliuer.blog.51cto.com/11859529/1892281
The function of three quotes in Python (two-point summary of commas)