文件路径的处理_1

import   os

b=os.path.join(r'C:\','asc')      #拼接路径
print(b)

os.chdir(r'E:pandas练习')     #指定当前的py文件所在目录
print(os.getcwd())             #查看当前py文件所在目录
a=os.listdir()                  #获取当前目录下所有的文件
for  i in a:
    print(i,os.path.isdir(i))   #os.path.isdir()判断是否是文件夹
   
原文地址:https://www.cnblogs.com/luckiness/p/13292384.html