# coding=utf-8
import os currentPath = os.getcwd() # 当前目录
parent_path = os.path.dirname(currentPath) #将当前目录传入得到当前目录的父目录
print(parent_path)

Python 父目录获取的更多相关文章

  1. TDirectory.GetParent获取指定目录的父目录

    使用函数: System.IOUtils.TDirectory.GetParent class function GetParent(const Path: string): string; stat ...

  2. C# 如何获取当前应用程序的父目录

    //获取当前运行路径的上级目录(父目录) System.IO.DirectoryInfo topDir = System.IO.Directory.GetParent(System.Environme ...

  3. php获取父目录的方法 dirname()

    dirname() 方法,获取父目录的方法,官方文档:http://php.net/manual/en/function.dirname.php 在 php 7.0 后,dirname() 支持两个参 ...

  4. bat 获取当前目录的父目录

    bat 获取当前目录的父目录 @echo off echo batchfile=%0 echo full=%~f0 setlocal for %%d in (%~dp0.) do set Direct ...

  5. Linux & Python 导航目录

    < Python学习手册(第4版)>< Python Cookbook(第2版)>中文版.pdf< Python 高级编程>< Python 基础教程 第二版 ...

  6. python相对目录的基本用法(一)

    一般在代码中涉及到操作文件时,最好使用文件的相对目录,这样在你的程序迁移到别人的电脑时,可以保证不会出现文件读取异常的错误(另外,自动化测试时用例的读取也要用相对目录) 例子1 假如工程文件的目录结构 ...

  7. Atitit图片复制父目录给你设计的实现 基于win 图片浏览器

    Atitit图片复制父目录给你设计的实现 基于win 图片浏览器 打开属性,获取其路径...1 Ahk参数传递,使用环境变量即可1 如何ahk异常转换为java异常1 如何获取ahk的输出.1 C:\ ...

  8. python模块目录文件后续

    1,新增PythonModule加载path Ruiy tip(关于python list[]数据库类型特殊你懂的!append(""),extend([""] ...

  9. Python多层目录模块调用

    一. 引用模块在 父+级目录中: 1. 将导入模块所在目录(../model/模块)添加到系统环境变量path下,可添加多个 import syssys.path.append("../mo ...

随机推荐

  1. DWR组件——基于远程过程调用实现Ajax

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6686115.html  一:DWR的用途 DWR(Direct Web Remoting)是一个Web远程调用 ...

  2. 【leetcode】solution in java——Easy1

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6409067.html 1:Hamming distance The Hamming distance betw ...

  3. sqrtx-开平方

    Implementint sqrt(int x). Compute and return the square root of x. 逐次逼近 class Solution { public: int ...

  4. 〖Linux〗Shell十进制数值转换十六进制

    dec2hex(){ printf } a=$(dec2hex ) echo $a

  5. django之创建第6-2个项目-过滤器列表

    转载:http://www.lidongkui.com/django-template-filter-table 一.转化为小写 {{ name | lower }} 二.串联:先转义文本到HTML, ...

  6. linux 上配置tomcat、mysql 开机启动

    1.tomcat 开机启动 方法一.修改系统文件 (已经尝试,可以) 1.修改/etc/rc.d/rc.local vi /etc/rc.d/rc.local 2.添加下面两行脚本,记住是两行,仅仅第 ...

  7. Android 代码画角标 offcutView

      效果如下:          代码: <com.andye.OffcutView android:layout_width="30dp" android:layout_h ...

  8. CSRF攻击与防御(写得非常好)

    转自:http://blog.csdn.net/stpeace/article/details/53512283 CSRF概念:CSRF跨站点请求伪造(Cross—Site Request Forge ...

  9. tensorflow内存溢出问题

    Tensorflow的静态图结构简洁清晰,符合人的思维.虽然编程上略微有些复杂,但是原理很容易看懂. Tensorflow分建图过程和运行图(张量求值)两个阶段,在这两个阶段中都可以定义操作和张量.但 ...

  10. jenkins 图文教程 下载 --》安装--》更改默认端口号,附自启动脚本

    参考文章: 1.http://www.ibm.com/developerworks/cn/java/j-lo-jenkins/ 2.http://blog.csdn.net/zhaolixin007/ ...