📜  python os 是目录 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:13.886000             🧑  作者: Mango

代码示例1
import os.path
  
# Path
path = '/home/User/Documents/file.txt'
  
# Check whether the 
# specified path is an
# existing directory or not
isdir = os.path.isdir(path)
print(isdir)
  
  
# Path
path = '/home/User/Documents/'
  
# Check whether the 
# specified path is an
# existing directory or not
isdir = os.path.isdir(path)
print(isdir)