当前位置:网站首页>ftplib+ tqdm 上传下载进度条
ftplib+ tqdm 上传下载进度条
2022-08-09 12:37:00 【洪大宇】
from fileinput import filename
import tqdm
import ftplib
server = "192.168.119.100"
port = 2121
ftp = ftplib.FTP()
#ftp.set_debuglevel(2)
ftp.connect(server,port)
ftp.login()
pwd = ftp.pwd()
ftp.cwd("xilinx")
filename="u-boot-xlnx-xilinx-v2021.2.zip"
size = ftp.size(filename)/1024
from tqdm import tqdm
import time
#fd = open(filename,"wb")
# with tqdm(total=size,desc='Download {}'.format(filename)) as pbar:
# def call_(data):
# l = len(data)/1024
# pbar.update(l)
# fd.write(data)
# ftp.retrbinary("RETR {}".format(filename),call_)
import os
filename="u-boot-xlnx-xilinx-v2021.2-debug.zip"
size = os.path.getsize(filename)/1024
fp = open(filename,"rb")
with tqdm(total=size,desc='Download {}'.format(filename)) as pbar:
def call_(data):
l = len(data)/1024
pbar.update(l)
ftp.storbinary("STOR {}".format(filename),fp,callback=call_)
边栏推荐
猜你喜欢
26、管道参数替换命令xargs
ansible-cmdb friendly display ansible collects host information
Rust 入门指南(使用JSON)
Flutter Getting Started and Advanced Tour (3) Text Widgets
告别手摇织布机的AI时代
我的2020年终总结
你没见过的《老友记》镜头,AI给补出来了|ECCV 2022
Report: The number of students who want to learn AI has increased by 200%, and there are not enough teachers
透明tune proxy
内网穿透工具ngrok使用教程
随机推荐
基于CAP组件实现补偿事务与幂等性保障
安踏携手华为运动健康共同验证冠军跑鞋 创新引领中国体育
如何求最大公约数?
Simple encapsulation of glide tool class
win10编译x264库(也有生成好的lib文件)
MySQL备份与恢复 (转载非原创)
技术分享 | 接口自动化测试如何处理 Header cookie
第六届”蓝帽杯“全国大学生网络安全技能大赛 半决赛
随机快排时间复杂度是N平方?
保存Simulink仿真模型为图片或者PDF的方法
Ten minutes to teach you how to use VitePress to build and deploy a personal blog site
【微服务~远程调用】整合RestTemplate、WebClient、Feign
30行代码实现蚂蚁森林自动偷能量
无重复字符的最长子串
曼城推出可检测情绪的智能围巾,把球迷给整迷惑了
ABAP 面试题:如何使用 ABAP 编程语言的 System CALL 接口,直接执行 ABAP 服务器所在操作系统的 shell 命令?
ctfshow七夕杯2022
Flutter Getting Started and Advanced Tour (7) GestureDetector
用 API Factory 产品生成 API 文档
1-hour live broadcast recruitment order: industry big names share dry goods, and enterprise registration opens丨qubit·viewpoint