Products
GG网络技术分享 2025-11-14 03:35 4
python import os
def create_file: with open as file: file.write

def open_file: with open as file: content = file.read print
def readwritefile: with open as file: file.write with open as file: content = file.read print
def delete_file: if os.path.exists: os.remove
def create_directory: if not os.path.exists: os.makedirs
def list_directory: files = os.listdir for file in files: print
if name == "main": # 创建文件 createfile # 读写文件 readwritefile # 删除文件 deletefile
# 创建目录
create_directory
# 列出目录内容
list_directory
# 切换目录
change_directory
#
列出目录内容
list_directory
# 删除目录
delete_directory
Demand feedback