from glob import glob
# this gives all the folders that answer to this pattern
folders = glob(r'C:\Program Files\example*')
folder = folders[0] # pick the first one
在操作系统模块中附加所需的文件名
import os
file_name = 'file.txt'
file_path = os.path.join(folder, file_name)
您可以使用^{} 模块
在操作系统模块中附加所需的文件名
然后将文件保存到
file_path
相关问题 更多 >
编程相关推荐