#coding=UTF-8
import os
# 當前路徑
current_path = os.path.dirname(__file__)
# 上一級路徑(父級路徑)
parent_path = os.path.dirname(current_path)
print("當前路徑:" + current_path)
print("上一級路徑:" + parent_path)
Python獲取當前目錄路徑和上一級目錄路徑(父級路徑)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Python3 012:100到200的素數
依汉南
2020-07-08 05:45:09
Python3 個稅計算
依汉南
2020-07-08 05:45:09
Python3 階乘求和
依汉南
2020-07-08 05:45:09
Python3 磁盤讀寫
依汉南
2020-07-08 05:45:09
Python3 完全平方數
依汉南
2020-07-08 05:45:09
Python3 這天第幾天
依汉南
2020-07-08 05:45:09
Python3 copy
依汉南
2020-07-08 05:45:09
Python3 數字組合
依汉南
2020-07-08 05:45:09
關於 Jupyter notebook 的 kernel error 問題
汤姆鱼
2020-07-07 23:19:57
Anaconda 和 PyCharm 的安裝與配置
汤姆鱼
2020-07-07 23:19:57
Python3 學習筆記之基礎語法
汤姆鱼
2020-07-07 23:19:57
python生成pyc
jiguoguo
2020-07-07 22:43:30
開啓CSDN筆記模式
時間荏苒,今天以前同事請我下載CSDN資源,無意登錄賬號,已經碼農13年。 把我所有筆記陸續更新到CSDN,重拾10餘年前的習慣。
jiguoguo
2020-07-07 22:43:30
centos安裝思源黑體
jiguoguo
2020-07-07 22:43:30
24小時熱門文章