2024-04-26 11:42:41 发布
网友
Possible Duplicate:How to identify whether a file is normal file or directory using python
如何检查路径是python中的目录还是文件?
使用os.path.isdir(path)
os.path.isdir(path)
更多信息请点击http://docs.python.org/library/os.path.html
许多Python目录函数都在^{} module中。
import os os.path.isdir(d)
os.path.isfile("bob.txt") # Does bob.txt exist? Is it a file, or a directory? os.path.isdir("bob")
使用
os.path.isdir(path)
更多信息请点击http://docs.python.org/library/os.path.html
许多Python目录函数都在^{} module 中。
相关问题 更多 >
编程相关推荐