中。

假设当前目录为D:\code,则可以使用以下代码实现:

import shutil

src_dir = r'\\192.168.1.2\共享盘\tools'
dst_dir = r'D:\code'

shutil.copy2(src_dir + r'\1.k', dst_dir)
shutil.copy2(src_dir + r'\2.k', dst_dir)

其中,src_dir为共享盘中tools文件夹的路径,dst_dir为当前目录的路径。shutil.copy2()函数可以将源文件复制到目标路径中,并保留文件的元信息。

python从局域网共享盘19216812的tools文件夹复制1k 2k 文件放到当前目录下的代码

原文地址: https://www.cveoy.top/t/topic/hiaY 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录