Python connection Database exception ' latin-1 ' codec can ' t encode characte

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.