logo
  • 教程列表
  • SO官方文档
  • Oskpth
    • 加入路径
    • 路径组件操作
    • 相对路径的绝对路径
    • 获取父目录
    • 如果给定路径存在
    • 检查给定路径是否是目录文件符号链接挂载点等
  1. StackOverflow 文档
  2. Python Language 教程
  3. Oskpth
  4. 相对路径的绝对路径

相对路径的绝对路径

Created: November-22, 2018

Use os.path.abspath:

>>> os.getcwd()
'/Users/csaftoiu/tmp'
>>> os.path.abspath('foo')
'/Users/csaftoiu/tmp/foo'
>>> os.path.abspath('../foo')
'/Users/csaftoiu/foo'
>>> os.path.abspath('/foo')
'/foo'
  • 获取父目录
  • 路径组件操作

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明