The following articles describe the concept of a Python object and introduce the Code related to the use of variables and character constants in a Python object. The following describes the content of this article, I hope you will gain some benefits after reading the following articles.
Python tends to call everything an object.
Example: Use variables and character constants
- #Filename:Var.py
- i=5
- print(i)
- ii=i+1
- print(i)
- s='''This is a multi-line string.
- This is the seconde line.'''
- print(s)
Output:
- 5
- 6
- This is a multi-line string.
- This is the seconde line.
Assign values directly when using the variable. You do not need to specify the data type. By default, a logical row is associated with a physical row image. If you want to put multiple logical rows in a physical row, you can add a semicolon after each statement. However, it is strongly recommended that only one logical row be written for each physical row. A logical row can be connected by '\' across multiple physical rows.
- >>> s='This is a string.\
- This is continues the string.'
- >>> print(s)
- This is a string.This is continues the string.
The above content is an introduction to the practical application solutions of Python objects.