Python (2.6)常用的API

xiaoxiao2021-02-27  253

文件系统操作相关的API os.path.exists() 判断某个路径是否存在os.path.isfile()/isdir() 判断某个路径是文件还是目录os.path.basename() 获取文件名或目录名,例如os.path.basename("/a/b/c.txt") = c.txtos.path.dirname() 获取parent目录的路径信息,例如os.path.dirname("/a/b/c") = "/a/b"os.path.join() 拼接一个路径,例如:os.path.join("a", "b", "c") = "a/b/c" (分割符取决于OS)
转载请注明原文地址: https://www.6miu.com/read-8738.html

最新回复(0)