# 连接数据库 con = pymysql.connect(host="localhost", port=3306, user="xxx", password="xxxxxx", database="xxx", charset="utf8") cur = con.cursor() cur.execute("show tables;") res = cur.fetchall() for table in res: print(table)