import os
curPath = os.getcwd() #获取当前路径
fatherPath = os.path.dirname(curPath) # 获取当前路径的上一级路径
os.path.join(fatherPath, 'test') #获取和当前同级的另一路径test
paths = os.listdir() #获取当前所有路径
#检查某文件是否存在
os.path.exists(file)
os.path.isfile(file)
【python】文件操作相关
最新推荐文章于 2021-02-09 20:19:30 发布