import win32ui import shutil import os current_path = os.getcwd() print(current_path) def copy_file(src_path, dst_path): shutil.copy(src_path, dst_path) dlg = win32ui.CreateFileDialog(1) # 参数 1 表示打开文件对话框 dlg.SetOFNInitialDir('C://') # 设置打开文件对话框中的初始显示目录 dlg.DoModal() filename = dlg.GetPathName() print(filename) if filename is not None and filename != "": copy_file(filename, current_path + "/license.txt")