Variables and strings in Python
Variable:
1. Variable naming rules: Letters, numbers, underscores, cannot start with a number
2, the variable is assigned with the = number
3, the reference of the variable directly using the variable name, no other with the help of other symbols
String:
1, the string to be quoted in single or double quotation marks, and in pairs appear
2. You can use \ to escape special characters
3. Use of raw characters: when you encounter special characters that require multiple escapes, you can use the original character pairs to escape a special character in the entire string. It is simple to use, just precede the string with a character R!
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/88/55/wKioL1fwsOWQu-w8AAAzMBe4fH0312.png-wh_500x0-wm_3 -wmp_4-s_4263867804.png "title=" Rchar.png "alt=" Wkiol1fwsowqu-w8aaazmbe4fh0312.png-wh_50 "/>
But one thing to note is that after using the escape character, the last character cannot be a special character, if a special character is used directly, for error, when there are other workarounds
>>> str = R ' C:\now\david\abc\ '
Syntaxerror:eol while scanning string literal
4, long string: If you need to get a string that spans multiple lines, you can use a long string and a long string with a triple quote string:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/88/58/wKiom1fwsnKDJ9B9AAA-xUoVARA777.png-wh_500x0-wm_3 -wmp_4-s_1735411117.png "title=" Triquot.png "alt=" Wkiom1fwsnkdj9b9aaa-xuovara777.png-wh_50 "/>
This article is from the "Davidlee's Linux Road" blog, so be sure to keep this source http://davidlinux.blog.51cto.com/5965954/1858385
Python Basic Learning Notes (iv)