python getcwd_Python3 os.getcwd() 方法
Python3 os.getcwd() 方法
概述
os.getcwd() 方法用于返回当前工作目录。
语法
getcwd()方法语法格式如下:
os.getcwd()
参数
无
返回值
返回当前进程的工作目录。
实例
以下实例演示了 getcwd() 方法的使用:
#!/usr/bin/python3
import os, sys
# 切换到 "/var/www/html" 目录
os.chdir("/var/www/html" )
# 打印当前目录
print ("当前工作目录 : %s" % os.getcwd())
# 打开 "/tmp"
fd = os.open( "/tmp", os.O_RDONLY )
# 使用 os.fchdir() 方法修改目录
os.fchdir(fd)
# 打印当前目录
print ("当前工作目录 : %s" % os.getcwd())
# 关闭文件
os.close( fd )
执行以上程序输出结果为:
当前工作目录 : /var/www/html
当前工作目录 : /tmp
python getcwd_Python3 os.getcwd() 方法相关推荐
- python getcwd_Python os.getcwd()方法
Python os.getcwd()方法 概述 os.getcwd() 方法用于返回当前工作目录. 语法 getcwd()方法语法格式如下: os.getcwd() 参数 无 返回值 返回当前进程的工 ...
- python getcwd_Python os.getcwd() 方法
Python os.getcwd() 方法 概述 os.getcwd() 方法用于返回当前工作目录. 语法 getcwd()方法语法格式如下: os.getcwd() 参数 无 返回值 返回当前进程的 ...
- Python os.getcwd() 方法
Python os.getcwd() 方法 转存失败 Python OS 文件/目录方法 概述 os.getcwd() 方法用于返回当前工作目录. 语法 getcwd()方法语法格式如下: os.ge ...
- python getcwd 转义,Python os.getcwd() 方法
Python os.getcwd() 方法 概述 os.getcwd() 方法用于返回当前工作目录. 语法 getcwd()方法语法格式如下: os.getcwd() 参数 无 返回值 返回当前进程的 ...
- python os.getcwd用法_Python3 os.getcwd() 方法
Python3 os.getcwd() 方法 概述 os.getcwd() 方法用于返回当前工作目录. 语法 getcwd()方法语法格式如下: os.getcwd() 参数 无 返回值 返回当前进程 ...
- os.getcwd上两级_Python os.getcwd() 方法
Python os.getcwd() 方法 概述 os.getcwd() 方法用于返回当前工作目录. 语法 getcwd()方法语法格式如下: os.getcwd() 参数 无 返回值 返回当前进程的 ...
- python renames_Python os.renames() 方法
Python os.renames() 方法 概述 os.renames() 方法用于递归重命名目录或文件.类似rename(). 语法 renames()方法语法格式如下: os.renames(o ...
- python使用os.system()方法进行多模块安装
划重点: python开发的时需要下载很多的模块,所以我们可以使用os.system()方法来自动安装所需模块 # -*- coding: utf-8 -*- # @FileName: 自动安装模块. ...
- python getcwd_Python os.getcwd()函数的实际应用方案介绍
Python os.getcwd()函数获得当前的路径时,你对Python os.getcwd()函数获得当前的路径的原型是否了解,以下的文章就是对其原型的具体分析,以下就是文章的相关内容的具体介绍. ...
最新文章
- php 下 html5 XHR2 + FormData + File API 上传文件
- 只有mdf文件的恢复技术
- 一步一步掌握设计模式一(最简单的开始--单例模式^_^)
- Linux文件系统和文本编辑器
- 图中异色点对最短距离(最小生成树+线段树)
- python登录系统的实现方法_python实现简单登陆系统
- DistributionDB过大的原因
- Yii2语言国际化配置Twig翻译解决方案
- 项目开发周期与数据库设计对比
- moosefs即将发布新版
- 保存用户数据到mysql_MySQL中所有用户信息都保存在【 】数据表中。
- VB添加TTS语音合成
- 一文教你如何解决TXC晶振工作不正常的问题
- 酷Q萌萌机器人_GitHub - Titvt/CQRobot: 酷Q机器人——麦萌萌小管家
- STM32串口驱动安装攻略
- 网络协议抓包分析与爬虫入门
- 坚果pro2官方rom_坚果 pro2线刷包_坚果 pro2刷机包_坚果 pro2固件包_坚果 pro2救砖包 - 线刷宝ROM中心...
- autoproxy插件下载 linux,AutoProxy 0.29.6
- 父亲母亲-山里老房子
- Android之在app图标添加角标