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

  • 關於本站
  • 免責聲明