An escape character
When Python see the backslash (\), that is, when the escape character, should know to be seen as a double-quote character, rather than a data type indicator.
>>>print("I said , \"Don't do it \"")
I said , "Don't do it "
Second, the two series strings
Each programmer will encounter take two or a plurality of strings are joined together, which is called concatenation (concatenation)
The first 2.1: added after the first string a space
>>> "John" "Everyman"
'JohnEveryman'
2.2 second: simply use a delimiter
>>> "John" + " " + "Everyman"
'John Everyman'
2.3 Third: a print () function connection string
>>> print("John" , "Everyman")
John Everyman
Third, the concatenated string using different methods
Format specifier, by inserting a specific sequence of characters work, the character sequences are interpreted as a placeholder Python, and substitutes the value provided by the programmer. At first glance, this method is very complex and not very useful, but the format specifier can control the format of the information to be displayed, it can also provide many useful tips
>>> "John Q. %s" % ("Public")
'John Q. Public'
Example shows
% S specifier is for the format string. % Symbol string outer surface behind which all values are inserted into a corresponding format string at specifier.
Note that the parentheses, it tells the latter sequence comprising the string values for filling the format specifier.
>>> "%-5s %s %10s" % ("John" , "Every" , "Man")
'John Every Man'
Example shows
When word Man appears far away from the front of the word, because the last added format specifier 10 shows a string of length 10. If the string is not 10 characters (it contains only three characters, i.e. Man), it will forward a word with the addition of Man intermediate space 7.
Every word is separated by a space different from the way other words, because the space on the left, not the right. The sign on the right character format specifier, which format will appear on the right word. If you use a non-negative value, it appears on the left