python error collection

 

 -----------------------------------------------------------------------

报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 70: illegal multibyte sequence

Error while reading the ini file using ConfigParser:

The reason: ini file using Chinese characters; after deleting characters, normal reading; and the corresponding value, without adding a single quotation marks, or single quotation marks will be treated as part of the value

Solution: When a file can be read, add the encoding rules: encoding = 'utf-8-sig'

 -----------------------------------------------------------------------

报错:non-default argument follows default argument 

Reason: the def get_value (self, option, section = None), the 'section = None' in the front of the 'option' is
option must pass parameters, but the section can not pass; if the section on the front, it should be how to understand the function of this parameter it? The section on the back, can solve this problem.
The first parameter passed is certainly option, will not be the section; as to whether the incoming section, to see if there is value after the first argument.
 
 

Guess you like

Origin www.cnblogs.com/George19950505/p/12649765.html