参考https://blog.csdn.net/pengneng123/article/details/131111713
import pymysql
import pandas as pd
#import openpyxl
import xlsxwriter
db = pymysql.connect(
host="10.41.241.114",
port=***,
user='***',
password='***',
charset='utf8mb4'
)
cursor = db.cursor() #创建游标对象
sql = 'use season;' #sql语句
cursor.execute(sql) #执行sql语句
df=pd.read_sql("""SELECT * FROM csod_employee_training_detail_g""",con=db)
df1=pd.read_sql("""SELECT * FROM csod_training_g""",con=db)
df2=pd.read_sql("""SELECT * FROM csod_training_schedule_g""",con=db)
df.to_excel(r'csod_employee_training_detail_g.xlsx',index=False, engine='xlsxwriter')
df1.to_excel(r'csod_training_g.xlsx',index=False, engine='xlsxwriter')
df2.to_excel(r'csod_training_schedule_g.xlsx',index=False, engine='xlsxwriter')
openpyxl.utils.exceptions.IllegalCharacterError 错误原因分析及解决办法https://blog.csdn.net/javajiawei/article/details/97147219