用到的核心模块有:os shutil
文件的创建:f = open("文件名", "w") 注:如果涉及到乱码问题需要在后面加上encoding="utf-8"
文件内容的读取:f = open("文件名", "r")
文件的重命名:os.rename("之前的名字", "想要修改的名字")
文件的删除:os.remove("需要删除的文件")
当前路径的获取:os.getcwd()
目录路径的转换:os.chdir("需要转换的路径")
目录的创建:os.mkdir("目录名")
目录的删除:os.rmdir("目录名")
注:如果想要删除非空的目录,需要用到shutil模块来删除:
shutil.rmtree("目录名')