python获取当前文件路径
作者:互联网
python获取当前文件路径
学习了:https://www.cnblogs.com/strongYaYa/p/7200357.html
https://blog.csdn.net/heatdeath/article/details/78070832
https://www.cnblogs.com/WonderHow/p/4403727.html
import osprint(os.getcwd())# for root, dirs, files in os.walk(os.getcwd()):# print(root) # 当前目录路径 # print(dirs) # 当前路径下所有子目录 # print(files) # 当前路径下所有非目录子文件listdir = os.listdir(os.getcwd())print(listdir)for name01 in listdir: if name01.startswith('out'): print(name01) file_address_x_y = open(name01, 'r', encoding='UTF-8') for address in file_address_x_y: # print(address) pass
标签:listdir,python,路径,name01,获取,address,print,os 来源: https://blog.51cto.com/u_15241951/2849778