python打印文件绝对地址
时间: 2023-10-18 15:25:31 浏览: 177
要在Python中打印文件的绝对路径,你可以使用以下代码:
`print(os.path.abspath('文件路径'))`
其中,'文件路径'是你要打印绝对路径的文件的路径。如果你要打印当前文件的绝对路径,可以使用以下代码:
`print(os.path.abspath(__file__))`
这将打印出当前文件的绝对路径。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python 打印当前文件相对路径和绝对路径](https://blog.csdn.net/weixin_34309435/article/details/94215248)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [python3中分别用递归,栈,和队列打印出目录中所有文件的绝对路径的三种方法](https://blog.csdn.net/jimmy_gyn/article/details/79165177)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [xml文件批量处理python脚本](https://download.csdn.net/download/caoxinri123/88239057)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文