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