1.lists are medium brackets.for example age = [2,3,56,9]

2.dictionary tables are brackets for example name={‘xiaoming’:30, ‘huahua’:80,‘gender’:‘kk’}
there are two ways to index numeric values in a dictionary.
one is an index key in the forn of name [‘xiaoming’],
the other is to use get() function, such as name.get(‘gender’),
which can be assignde if there is no key in get , such as name.get(‘age’,20)
the name dictionary adds an age key and assigns 20

3.tuples are parentheses, and no subscript index can be used to modify values, for example big =(1,2,1,1,1)
lists can be modified by index values

5.use ‘{0:.2f}’.format(variable) for data formatting, which means keeping two decimal digitspython number and string
6.unequal symbols are ‘!=’

7.method of keeping integers only
(1) ‘//’ is retain integer and retain high precision for example 10//4.0 >>>2.0
(2) the math.floor integer part is the value of the coordinate axis near the left
(3) math.trunc is the reserved value approcaching zero
(5) round is rounded(四舍五入)
python number and string
8. other digits correspond to decimal values
0o stands for octal 0x for hexadecimal 0b for binary, 8421 method inbinary system
python number and string
9. the decimal system is converted to other systems as shown below
python number and string
9. using decimal module to make the numerical value more precise
python number and string
10. ‘’’ ‘’’ marks define a description document,

  1. common use of signle and double quotation marks are used as follows
    python number and string
  2. commonly used backslash and its meaning for example \n mean line feed,\t mean enter four spaces \a mean bell
  3. in the statement we can add r so that what we declare is what we export so as follows
    python number and string
    15 some common operations of strings, as shown below
    python number and string
    python number and string
    16 when a value needs to be changed frequently, it can be defined as a list and then coverted into a string
    python number and string
    python number and string
    python number and string
    17 a method of segmenting strings and judging the first character and end it。 as follows
    python number and string
  4. find an index of the location of an element
    python number and string
    19.Examples of Format Use
    python number and string
  5. the types in the array are consistent , and the data types in the list can be different
    21.‘in ’ special words can determine whether a data is in the list or not as follows
    python number and string
  6. some other uses
  7. python number and string
  8. in the replacement of elements in the list, the principle of selecting values in the list is to leave the values in front and the final values should not be ,such as[1;2], the values at position 2 shuold be rounded off
    python number and string
  9. addition an element to a list and extending a list of list as shown below
  10. python number and string
  11. list support in-siu changes,but string do not support in-situ changes,in-situ changes are changes,after nonin-situ changes are changed, the original object needs to be reassigned to save the changed amount
  12. python number and string
  13. python number and string
  14. python number and string
  15. multiple objects point to the same reference, modify a variable and other variables point to the reference change
  16. if copy assignment is used it will not change at the same time following chart
  17. python number and string
  18. python number and string
    summary
    python number and string

相关文章: