From 41c6c887f56fc9ef21c29bf29cf538b25cc8d818 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Fri, 15 Mar 2024 15:16:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/main.py b/test/main.py index 6cbba1a..4d39bb9 100644 --- a/test/main.py +++ b/test/main.py @@ -61,11 +61,13 @@ def tasks(device: str, start_time: str, end_time: str): start = datetime.datetime.now() start_str = start.strftime("%Y-%m-%d %H:%M:%S.%f") print(f"{start_str} 开始下载: {url}") - urllib.request.urlretrieve(url, - f"{tmp_path}/{device}_{start_time}_{end_time}.mp4") + file_path = f"{tmp_path}/{device}_{start_time}_{end_time}.mp4" + urllib.request.urlretrieve(url, file_path) end = datetime.datetime.now() print( f"{device} {start_time}-{end_time}: 下载用时: {(end - start).total_seconds()} 秒") + stats = os.stat(file_path) + print(f"文件 {file_path} 大小: {stats.st_size}") if __name__ == '__main__':