Python对文件和目录的操作

查看、创建和删除目录:

import os
#查看当前目录的绝对路径
os.path.abspath('.')

#在某个目录下创建一个目录
os.path.join('root','xxx') #首先把新目录的完整路径表示出来
os.mkdir('root.xxx')

#删除一个目录
os.rmdir('root.xxx')

猜你喜欢

转载自blog.csdn.net/qq_38213612/article/details/79731910