美文网首页
【Python】os.getcwd()

【Python】os.getcwd()

作者: 盐果儿 | 来源:发表于2023-06-02 04:04 被阅读0次

os.getcwd():获取当前工作路径(get current working directory)

import os

current_dir = os.getcwd()

print(current_dir) 

# Output: /path/to/current/directory

相关文章

  • OS Python

    os[operating system][Python 标准库] 路径 输出运行路径 os.getcwd() 路径...

  • 文件处理相关

    os.getcwd() 输出当前目录os.path.exists(r”c:\python\hello.py”)...

  • 第二章 python的日常使用

    1、使用python处理文件与文件夹 os.getcwd() 获取当前python程序的运行路径 os.path....

  • Python 3 标准库概览

    操作系统接口 >>> import os>>> os.getcwd()# 返回当前的工作目录'C:\\Python...

  • python中获取路径

    os.getcwd() 获取启动的python脚本的路径os.path.realpath(file) 获取当前被执...

  • 在Python 中获得当前路径

    转载自在Python 中获得当前路径 先要装载 os模块: import os print os.getcwd()...

  • os与sys

    os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径os.chdir("dirname"...

  • python3的工作目录设置

    #导入包 import os #查看python的默认工作目录 os.getcwd() #修改工作目录 os.ch...

  • os模块详解

    import os 获得当前文件的路径 1,os.getcwd()输出:'C:\\Python3'2,print ...

  • python学习1

    一、os.getcwd():返回当前进程的工作目录。 二、Python中有join和os.path.join()两...

网友评论

      本文标题:【Python】os.getcwd()

      本文链接:https://www.haomeiwen.com/subject/urmpedtx.html