python 中OS.path函数大全
来源:互联网 发布:java SQLexists用法 编辑:程序博客网 时间:2024/06/05 18:15
abspath(path)
Return the absolute version of a path.
basename(p)
Returns the final component of a pathname
commonprefix(m)
Given a list of pathnames, returns the longest common leading component
dirname(p)
Returns the directory component of a pathname
exists(path)
Test whether a path exists
expanduser(path)
Expand ~ and ~user constructs. If user or $HOME is unknown, do nothing.
expandvars(path)
Expand shell variables of form \$var and ${var}.Unknown variables are left unchanged.
getatime(filename)
Return the last access time of a file, reported by os.stat()
getctime(filename)
Return the creation time of a file, reported by os.stat().
getmtime(filename)
Return the last modification time of a file, reported by os.stat()
getsize(filename)
Return the size of a file, reported by os.stat()
isabs(s)
Test whether a path is absolute
isdir(path)
Test whether a path is a directory
isfile(path)
Test whether a path is a regular file
islink(path)
Test for symbolic link. On WindowsNT/95 always returns false
ismount(path)
Test whether a path is a mount point (defined as root of drive)
join(a, *p)
Join two or more pathname components, inserting "\" as needed lexists = exists(path) Test whether a path exists
normcase(s)
Normalize case of pathname. Makes all characters lowercase and all slashes into backslashes.
normpath(path)
Normalize path, eliminating double slashes, etc. realpath = abspath(path) Return the absolute version of a path.
split(p)
Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty. splitdrive(p) Split a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be empty
splitext(p)
Split the extension from a pathname. Extension is everything from the last dot to the end. Return (root, ext), either part may be empty.
splitunc(p)
Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters never have an UNC part.
walk(top, func, arg)
Directory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding '.' and '..'). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.
阅读全文
0 0
- python 中OS.path函数大全
- PYthon os.path 访问函数
- Python中join函数和os.path.join用法
- python中os.path模块下的函数总结
- Python 中 os.path 模块
- python中os和os.path模块
- os、os.path 模块中关于文件、目录常用的函数使用方法(python)
- python的os.path模块函数功能
- python os.path模块函数中文说明
- python中os.path常用模块
- python中os.path下的方法
- Python中os.path的妙用
- Python中os.path用法分析
- Python中os.path的妙用
- python中os.path模块的使用
- [Python]os模块和os.path模块的常用函数
- Python OS/OS.PATH/Built-in 常用函数
- python基础学习之os、os.path模块常用函数
- ElasticSearch集群搭建及配置监视服务
- 第五周 项目 1
- [YZOJ]P3281-小猿刷题-线性筛法优化
- 美图笔试题;浏览器访问XXX.com的时候发生了什么过程
- 文件系统与磁盘分区
- python 中OS.path函数大全
- BZOJ 1746: [Usaco2005 open]Lazy Cows
- 整合测试报告邮件发送
- 算法(一):排序
- 字节流与字符流的区别详解
- 修仙之路
- java多线程消息队列的实现
- spring源代码-aop
- 冒泡法排序及性能优化