os.path.abspath()错误
来源:互联网 发布:caffe训练模型 编辑:程序博客网 时间:2024/06/10 04:17
import os
import os.path
res = []
#def paththourgh(dir):
# for x,y,z in os.walk(dir):
# for i in z:
# if i[-3:] == '.py':
# res.append(os.path.join(x,i))
def paththourgh(dir):
for i in os.listdir(dir):
#print os.path.abspath(i)
if os.path.isdir(i):
#paththourgh(dir+os.sep+i)
paththourgh(os.path.abspath(i))
else:
if i[-3:] == '.py':
res.append(os.path.join(dir,i))
#res.append(os.path.abspath(i)) 这个函数输出是错误的,因为相当于调用的是
#os.path.normpath(os.path.join(os.getcwd(), path))getcwd获取的是脚本运行时的目录
if __name__ == '__main__':
paththourgh(r'D:\py')
print res
import os.path
res = []
#def paththourgh(dir):
# for x,y,z in os.walk(dir):
# for i in z:
# if i[-3:] == '.py':
# res.append(os.path.join(x,i))
def paththourgh(dir):
for i in os.listdir(dir):
#print os.path.abspath(i)
if os.path.isdir(i):
#paththourgh(dir+os.sep+i)
paththourgh(os.path.abspath(i))
else:
if i[-3:] == '.py':
res.append(os.path.join(dir,i))
#res.append(os.path.abspath(i)) 这个函数输出是错误的,因为相当于调用的是
#os.path.normpath(os.path.join(os.getcwd(), path))getcwd获取的是脚本运行时的目录
if __name__ == '__main__':
paththourgh(r'D:\py')
print res
0 0
- os.path.abspath()错误
- os.path.abspath(path)
- os.path.abspath 源码分析
- os.path.dirname/abspath函数
- os.getcwd && os.path.abspath详解
- os.path.abspath(sys.argv[0])学习
- Python os.path.abspath(__file__) 获取脚本完整路径
- os.path
- os.path
- os.path
- os.path
- os.path
- os.path
- os.path
- os os.path
- os和os.path模块
- Python3API之os.path
- os.path模块
- 全站https
- Android Phone架构设计
- android中的ellipsize
- qqoq3.0微博QQ登录插件
- Environment.getExternalStorageState介绍
- os.path.abspath()错误
- 如何不翻墙也能使用Gmail
- 浏览器标签图标通用写法
- PDF文件格式分析
- 与学习有关的l网站
- IP地址格式转换(htonl、ntohl;inet_addr、inet_ntoa)
- 在SQL-Server中,取出第n条到第m条记录简单分析
- iOS与JS的交互
- 解决wptouch插件播放视频问题