conn = pymysql.connect(
host='127.0.0.1',
port=3302,
user='username',
passwd='password',
db=database,
charset='utf8')
#此处要指定charset为utf-8(一般数据库编码都是utf8或utf8mb4之类),否则读取出的中文会乱码

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-06-21
相关资源
相似解决方案