import pymysql
import pandas as pd
db = pymysql.connect(
host='127.0.0.1',
user='root',
passwd='123456',
port=3306,
database='world',
charset='utf8'
)
pf = pd.read_sql("""
select * from city
""",con=db)
pf.to_excel("城市表.xlsx",index=False)
标签:导入到,execl,python,pymysql,pf,pd,mysql,import From: https://www.cnblogs.com/slx-yyds/p/17146550.html