Python Os.path

Source: Internet
Author: User

Os.path.abspath (path) #返回绝对路径
os.path.basename (path) #返回文件名
os.path.commonprefix (list) #返回list (multiple paths), the longest path common to all paths.
os.path.dirname (path) #返回文件路径
os.path.exists (path) #路径存在则返回True, path corruption returns false
os.path.lexists #路径存在则返回True, path corruption also returns true
os.path.expanduser (path) #把path中包含的 "~" and "~user" to the user directory
os.path.expandvars (path) #根据环境变量的值替换path中包含的 "$name" and "${name}"
os.path.getatime (Path) #返回最后一次进入此path的时间.
os.path.getmtime (Path) #返回在此path下最后一次修改的时间.
os.path.getctime (path) #返回path的大小
os.path.getsize (path) #返回文件大小, returns an error if the file does not exist
os.path.isabs (path) #判断是否为绝对路径
os.path.isfile (path) #判断路径是否为文件
os.path.isdir (path) #判断路径是否为目录
os.path.islink (path) #判断路径是否为链接
os.path.ismount (path) #判断路径是否为挂载点 ()
Os.path.join (path1[, path2[, ...]) #把目录和文件名合成一个路径
os.path.normcase (path) #转换path的大小写和斜杠
Os.path.normpath (path) #规范path字符串形式
Os.path.realpath (path) #返回path的真实路径
Os.path.relpath (path[, start]) #从start开始计算相对路径
os.path.samefile (path1, path2) #判断目录或文件是否相同
os.path.sameopenfile (FP1, FP2) #判断fp1和fp2是否指向同一文件
Os.path.samestat (STAT1, STAT2) #判断stat tuple STAT1 and Stat2 point to the same file
os.path.split (path) #把路径分割成dirname和basename, returns a tuple
os.path.splitdrive (path) #一般用在windows下, returns a tuple of drive names and Paths
os.path.splitext (path) #分割路径, returns a tuple of pathname and file name extension
os.path.splitunc (path) #把路径分割为加载点与文件
os.path.walk (path, visit, Arg) #遍历path, enter each directory to invoke the visit function
os.path.supports_unicode_filenames #设置是否支持unicode路径名

Python Os.path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.