1、os.path.realpath(__file__):返回当前文件的真实路径

2、os.path.dirname(path):去掉文件名返回目录,这里的文件名就是路径的最后一个,可以是文件,也可以是目录(可以理解为返回上一级目录)

 3、os.path.join():路径拼接函数

13、os.path模块获取文件路径常用方法

 

 

 

 

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
猜你喜欢
  • 2021-12-18
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案