小编abh*_*nan的帖子

如何使用python直接创建一个csv文件到ftp服务器?

我有一个代码来创建一个 csv 文件并且可以将它上传到 ftp 服务器

with open(csv_file, 'w') as csvfile:
    writer = csv.DictWriter(csvfile, fieldnames=csv_columns1) #csv_columns1 is a list of value to become  as heading
    writer.writeheader()
    for data in vals['details']:# values for the header
        writer.writerow(data)
    writer = csv.DictWriter(csvfile, fieldnames=csv_columns2)#csv_columns1 is a list of value to become  as heading
    writer.writeheader()
    writer = csv.DictWriter(csvfile, fieldnames=csv_columns)#csv_columns1 is a list of value to become  as heading
    writer.writeheader()
    for data in vals['OrderLine']:# values for the header
        writer.writerow(data)
        print(os.system('pwd'))

     Output_Directory = "ftp_path_to_store_file"
     username = "ftp_user_names"
     password = …
Run Code Online (Sandbox Code Playgroud)

python ftp file python-3.x

2
推荐指数
1
解决办法
1257
查看次数

标签 统计

file ×1

ftp ×1

python ×1

python-3.x ×1