我正在查询MySQL数据库并从表中获取数据。我的代码看起来像这样
# login creds, etc., etc.,
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM myTable")
我想,一切似乎都正常,但当我将数据导出到文本文件时
myresult = mycursor.fetchall()
df = pd.DataFrame(myresult)
#print(df)
df=str(df)
outF = open("C:\\Users\\ryans\\OneDrive\\Desktop\\test.txt", "w")
outF.writelines(df)
outF.close()
目前没有回答
相关问题 更多 >
编程相关推荐