python判断文件和文件夹是否存在

import os 
os.path.isfile('test.txt') #如果不存在就返回False 
os.path.exists(directory) #如果目录不存在就返回False

相关文章:

  • 2021-10-22
  • 2022-02-26
  • 2021-10-02
  • 2022-12-23
  • 2021-06-01
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
猜你喜欢
  • 2021-09-29
  • 2022-12-23
  • 2021-10-29
  • 2021-06-11
  • 2021-09-11
  • 2021-12-06
相关资源
相似解决方案