Os.path module of the Python module

Source: Internet
Author: User

#-*-coding:cp936-*-#python#Xiaodeng#Os.path module of the Python module#http://www.cnblogs.com/dkblog/archive/2011/03/25/1995537.html" "Os.path.abspath (Path) #返回绝对路径os. Path.basename (Path) #返回文件名os. Path.commonprefix (list) #返回list (multiple paths), The longest path common to all path. Os.path.dirname (Path) #返回文件路径os. Path.exists (path) #路径存在则返回True, path corruption returns Falseos.path.lexists #路径存在则返回True, Path corruption also returns Trueos.path.expanduser (path) #把path中包含的 "~" and "~user" into 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) # Determines whether an absolute path os.path.isfile (path) #判断路径是否为文件os. Path.isdir (Path) #判断路径是否为目录os. Path.islink (Path) #  Determine if the path is a link os.path.ismount (path) #判断路径是否为挂载点 () Os.path.join (path1[, path2[, ...]) #把目录和文件名合成一个路径os. Path.normcase (Path) #转换path的大小写和斜杠os. Path.normpath (Path) #规范path字符串形式os. Path.realpath (Path) # Return path's True path Os.path.relpath (path[, start]) #从start开始计算相对路径os. Path.samefile (path1, path2) # Determine if the directory or file is the same os.path.sameopenfile (FP1, FP2) #判断fp1和fp2是否指向同一文件os. Path.samestat (STAT1, StAT2) #判断stat If the tuple stat1 and Stat2 point to the same file Os.path.split (path) #把路径分割成dirname和basename, return a tuple of os.path.splitdrive (path) # Typically used under Windows, a tuple os.path.splitext (path) that returns the drive name and path #分割路径, returns the pathname and the file name extension of the tuple Os.path.splitunc (path) # Dividing the path into the load point and the file Os.path.walk (path, visit, Arg) #遍历path, enter each directory to invoke the Visit function, the visit function must have 3 parameters (ARG, dirname, names), DirName represents the directory name of the current directory, names represents all filenames under the current directory, and Args is the third parameter of walk Os.path.supports_unicode_filenames #设置是否支持unicode路径名" "

Os.path module of the Python module

Related Article

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.