JueLuo's Blog


  • Home

  • Categories

  • Archives

  • Tags

  • Search

Python 判断当前运行的文件所在的位置

Posted on 2019-01-10 | In Python
1
os.path.split(os.path.abspath(__file__))[0]

原理

os.path.abspath(__file__) 获取当前运行的文件的绝对路径 os.path.split(path)[0] 分割路径,元组的第一部分为路径,第二部分为文件名

# python
使用 rz 命令上传文件时出现错误:xxx was skipped
Python 使用 sqlite3 模块创建的数据库默认位置
  • Table of Contents
  • Overview
JueLuo

JueLuo

The better we get at getting better, the faster we will get better.

65 posts
21 categories
86 tags
GitHub Weibo Steam
  1. 1 原理
© 2015 - 2024 JueLuo
Powered by Jekyll
Theme - NexT.Pisces