📅  最后修改于: 2022-03-11 14:45:41.198000             🧑  作者: Mango
from ftplib import *
from io import StringIO
import pandas
import io
ftp = FTP('ftp.mysite.com')
ftp.login('un', 'pw')
ftp.cwd('/')
buffer = StringIO.StringIO()
your_pandas_df.to_csv(buffer)
text = buffer.getvalue()
bio = io.BytesIO(str.encode(text))
ftp.storbinary('STOR filename.csv', bio)