[python third day study notes]

variable

First, you need to assign a value to a variable before using it

Second, the rules of variable naming: can contain letters, numbers, underscores, but cannot start with a number

3. String:

1. Everything in quotation marks

2. Python strings need to be enclosed in quotation marks. There is no requirement for single or double quotation marks, but both sides must be in pairs, not single quotation marks on one side and double quotation marks on the other side.

3. Single or double quotation marks need to appear in the string

The first method: use the escape symbol "\".  

>>> 'let\'s go!'
"let's go!"

The second method:

>>> "Let's go!"
"Let's go!"

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324643298&siteId=291194637