Python os.path.join
来源:互联网 发布:大数据上升为国家战略 编辑:程序博客网 时间:2024/06/06 04:16
API文档:
os.path.join(path1[, path2[, ...]])
Join one or more path components intelligently. If any component is an absolute path, all previous components (on Windows, including the previous drive letter, if there was one) are thrown away, and joining continues. The return value is the concatenation of path1, and optionally path2, etc., with exactly one directory separator (os.sep) inserted between components, unless path2 is empty. Note that on Windows, since there is a current directory for each drive, os.path.join("c:", "foo") represents a path relative to the current directory on drive C: (c:foo), not c:\foo.
翻译文档:
连接一个或多个文件路径,例如:os.path.join('c:/',''foo'),输出:c:/foo
例子:
#! /usr/bin/env python
#coding=utf-8
import os
pathStr = 'c:/'
fList = [os.path.normcase(el) for el in os.listdir(pathStr)]
fList = [os.path.join(pathStr,f) for f in fList]
print fList
输出:
['c:/$recycle.bin', 'c:/360downloads'......]
- Python os.path.join
- 【Python】os.path.join
- python的os.path.join
- Python基本知识 os.path.join
- python str.join 和 os.path.join
- python中的os.path.join() 作用
- Python中join函数和os.path.join用法
- os.path.join()用法
- python的os.path.join()参数是绝对路径的问题
- Python os.path.join 双斜杠的解决方法
- python中拼接路径os.path.join的坑
- python基础(一)--join和os.path.join函数的用法以及字符串格式化
- os.path.join/os.mkdir/read_csv等
- Python os.path模块
- Python os.path模块
- python os.path
- [python] os.path模块
- python os.path模块
- 不动产登记证书曝光 一个“改变”必须注意(图)
- Tomcat转Jboss6.0 配置与修改
- SQL练习题+答案
- Markdown 语法说明 (简体中文版)
- C语言实现Windows服务并进行安装部署
- Python os.path.join
- AsEnumerable和AsQueryable的区别
- Oracle导库那些事儿
- 数据连接池的工作机制是什么?
- 【struts2】xWork容器之Container核心bean对象管理容器讲解
- Using and Abusing Data Visualization: Anscombe’s Quartet and Cheating Bonferroni
- 监控ping
- performSelector 和 cancelPreviousPerformRequestsWithTarget
- 10款流行的Markdown编辑器,总有一款适合你