Loading

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 os

print(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

 

posted @ 2018-05-30 20:04  stono  阅读(381)  评论(0编辑  收藏  举报