在这里,我尝试从file_path
获取new_folder
并添加dirctry = os.path.dirname(file_path)
toolSharePath = os.path.abspath(dirctry)
final_directory = os.path.join(toolSharePath, r'new_folder')
if not os.path.exists(final_directory):
os.makedirs(final_directory,exist_ok=True)
with open(final_directory, "w") as f:
f.write("data")
,然后将文件写入文件夹。
{{1}}