我需要从服务器获取文件,然后将它们写入数据库。我用:
with pysftp.Connection(host, username=username, password=password, cnopts=cnopts) as sftp:
sftp.chdir('path')
all_files = [file_name for file_name in sftp.listdir() if 'access' in file_name]
today_log = all_files[0]
all_files = all_files[1:]
df = df.append(sftp.get(str(today_log)))
但它返回None
。如何从文件中获取内容并将其写入数据框?