On the various problems in pyhton learning of beginners must see

  • 2020-06-01 10:06:37
  • OfStack

At present, it is quite chaotic, and there will be some additions in the future

1. Identifier

(1) identifiers are case sensitive.

(2) the identifier begins with a letter or an underscore, and may include letters, underscores, and Numbers.

(3) the identifier at the beginning of the underscore is of special significance.

2. The meaning of asterisk (*) before parameter

In the face of the actual situation, the number of parameters to be passed in cannot be known in advance, so an asterisk is added before the parameter to allow the function to accept as many parameters as possible. The situation is as follows:

(1) add an asterisk (*) before the parameter, and the parameter passed in is stored as a tuple;

(2) the parameter is preceded by two asterisks (*). The incoming parameter is stored in the form of a dictionary, and is called in the form of 'a=1,b=2,c=3'.

3. Requirements for dictionary keys

(1) the same key is not allowed to appear twice;

(2) the key must be immutable, so you can use a number, tuple, or string, but not a list.

Related articles: