Variable character encoding, data types, indent

Variables:
  variable number of intermediate results to a program stored in the calculation process, in order to facilitate subsequent calls.

Variable naming rules:

  1. To descriptive

  2. Variable names can only _, numbers, letters, spaces or special characters are not (#? <., ¥ $ *! ~)

  3. The variable name can not Chinese
  4 can not begin with a number
  5 key can not be used

  6. recommended wording variables: hump body (serverNamePython), underscore (the official recommended)

constant:

  In the python in all the variables are variable, with all uppercase variable names to represent this variable is constant

Variable assignment that is to open up the memory content storage assignment, the assignment variable to point to content that is not releasing memory (internal memory python complete release)

Character Encoding:

  The first support Chinese GB2312 encoding table

    1980 gb2312 6700+

    1995 gbk1.0 2W +

    2000    gb18030 2.7W+

  Unicode support unicode encoding all countries and regions, occupying a unified character 2byte, unicode backward compatible gbk, gb2312

  UTF-8 = unicode extended set of variable length coded character set

  Assic -->Gb2312 ->gbk1.0-->gb18030 

  Assic -->unicode -->utf-8

  python code, support Chinese statement: the first line to join #coding: uft-8

Note
  When row # Comments are
  multi-line comment with the three three single or double quotation marks' 'are annotated content' ''

User interaction:

  input contents are the input string

type of data:

  String str

    str + str (string splicing)

    str * int (int string to achieve stitching fold)

  Plastic (Digital) int

    For comparison and calculation

  Boolean value bool:

    For judging

    True - true

    False-- false / 0

  View Data Types

    type

    View Data Types

      int (str) - shaping the string into

      str (int) - converted into a string shaped

    type (the object to be detected)

indentation:

    Standard with 4 spaces to indent, IndentationError (indentation errors), indentation must be consistent

 

Guess you like

Origin www.cnblogs.com/zzzhao/p/11330979.html