Answers for "python check directory using os"

18

how to check in which directory python in running

import os
cwd = os.getcwd()
Posted by: Guest on March-09-2020
0

how to see directory from os module

import os

# detect the current working directory
path = os.getcwd()

# read the entries
with os.scandir(path) as listOfEntries:
    for entry in listOfEntries:
        # print all entries that are files
        if entry.is_file():
            print(entry.name)
Posted by: Guest on January-20-2021

Code answers related to "python check directory using os"

Python Answers by Framework

Browse Popular Code Answers by Language