Chapter III data type of the variable

@ Data type of the variable

Program consisting of small to large, the expression statement → → → program module.

Each expressions into statements, each statement combined into modules, each module is combined into a common program; we start with the smallest unit, expressions, start learning.

The simplest expression Liezi: num = 2 + 3 

Expression from a variety of data types;

Common data types: variables, arrays, strings, lists, tuples, dictionaries, files, Boolean, empty, set, functions, modules, classes, etc.

1, a variable, is dynamically typed letters, underline, the numbers may be numbers, strings, lists, variables assigned to tuples above. (Untyped variables are constrained, he depends on the type of the object; he just cited)

 

 python built-in data types, such as integers assigned to a variable of type int integer itself, just point to integer variable type.

No variable type, type only associated with an object.

After the variable assignment, they may be combined into a simple expression;

Re-reference variable, the variable has been assigned reassigned before the object will be treated as garbage collection, the variables will be redirected to the latest object.

Shared variable references, different variables can point to the same object.

Variable object pointed to is the address, for us it is not visible, but can be viewed by ID.

 

 We can determine an object's address is the same.

 

 

 Are these two objects are equal with == or is judged to True to indicate that they are equal.

When the value is greater than 256, the address of the variable points are different, it is Flase.

 Variable whether in automated test scripts or other programming are very useful in automated testing, we can use variables to get the actual results page, take the actual results are compared with the expected results; this operation is called the assertion in automation.

Assertion will be described in detail later.

 

Guess you like

Origin www.cnblogs.com/daodexuke/p/11788341.html