当前位置:网站首页>Common usage of OS (picture example)

Common usage of OS (picture example)

2022-06-23 13:28:00 365JHWZGo

subject

OS Common usage of

function

Sketch Map

The following examples are shown based on this
 Insert picture description here

Guide library

First, you need to import the corresponding library

import os

os.listdir(path)

meaning : Directory structure under the current path , Do not display secondary directories

path: route

Value meaning
“.” Current directory
“./path” Specific catalogue

 Insert picture description here
 Insert picture description here

os.path.abspath(path)

meaning : Current absolute path

path: route
 Insert picture description here

os.getcwd()

meaning : current path

 Insert picture description here

os.path.dirname(path)

meaning : The parent path of the current path

 Insert picture description here

原网站

版权声明
本文为[365JHWZGo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206231252362209.html

随机推荐