White school Python --- Day2

1, environment variables: tell the system automatically find the file location, the line can open the program you want to order directly through the system.

                       The input system environment variable to the location of the program, can be opened directly by the cmd command, for example: c: \ program can be executed directly hello.py

2, the variable Comments

            Variables: Popular that some of the intermediate results to a program stored in the calculation process, and the operation may be modified. Variable names are descriptive words, the value of the hidden variable, the variable name should look roughly can think about the meaning of the expression of the variable.

            Variable name written: name =. . .

                                 student_numeber (python recommended wording) = ....

                                 studentNumber (Microsoft wording) = .....

 

           Variable rules: variable name can only underscores, numbers, letters, can not be a space or special characters (#, *, etc.)

                             Chinese can not be a variable name (3.x versions while supporting Chinese, but if you write so, the company will get you fired yo)

                             You can not start with a number.

                             We should not be in upper case as the beginning.

                             Reservation characters can not be used as a variable name, such as program print if else statements and so on.

3, Constant

            Python does not distinguish between constants and variables, all amounts are variable, so use all uppercase variable names to represent this variable is constant. When the output result in quotes, the output string, without, the output of the variable results are shown in Table.

4, delete variables

             Since the variable has been occupied by memory, internal Python will automatically delete unused variable values, there are two ways:

              First: delete the variable name, del name, variable post-Python will point it's empty

              Second: the variable values ​​not corresponding to the variable name reassigned as age = 1, age = 2, print age = 2

Guess you like

Origin www.cnblogs.com/Kathrine/p/11242489.html