Exception: Unicodeencodeerror: ' latin-1 ' codec can ' t encode character U ' \u201c ' in position 0:ordinal not in range (256)
Need to set database connection encoding: DB = pymysql.connect (host= ' localhost ', user= ' root ', password= ' 123456 ', db= ' Yanpro ', port=3309, charset= ' UTF8 ')
If the setting is complete error: ' Nonetype ' object has no attribute ' encode ', it is possible to write charset= ' UTF8 ' as charset= ' utf-8 '!!!!
fuck! I stepped on this hole!
This time is to write a PYQT5 Excel data processing program, the customer provides the test data, has been using the shell operation Mariadb, rarely used navcat, when the data is large, only 1000 data per page, Navcat can be page ... Wow ...
Link Address:
Https://stackoverflow.com/questions/3942888/unicodeencodeerror-latin-1-codec-cant-encode-character
Https://stackoverflow.com/questions/16617988/nonetype-object-has-no-attribute-encode
Python connection Database exception ' latin-1 ' codec can ' t encode characte