小编Abd*_*adi的帖子

检查文件是否存在,如果不存在则创建新目录并在目录内创建文件并返回目录内的文件

import os

def new_directory(directory, filename):
  # Before creating a new directory, check to see if it already exists

  # Create the new file inside of the new directory

  # Return the list of files in the new directory

print(new_directory("PythonPrograms", "script.py"))
Run Code Online (Sandbox Code Playgroud)

python

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×1