Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get list of folders in directory python

import os 
my_list = os.listdir('My_directory')
Comment

python get all folders in directory

import os
subfolders = [ f.path for f in os.scandir(folder) if f.is_dir() ]
Comment

get list of all files in folder and subfolders python

for path, subdirs, files in os.walk(root):
    for name in files:
        print os.path.join(path, name)
Comment

how to get all folders on path in python

os.walk(directory)
[x[0] for x in os.walk(directory)]
Comment

PREVIOUS NEXT
Code Example
Python :: tensot to numpy pytorch 
Python :: save image requests python 
Python :: how to clear console in python 
Python :: extract ints from strings in Pandas 
Python :: python runtime 
Python :: code for showing contents of a file and printing it in python 
Python :: python how to access clipboard 
Python :: how to change background color in python turtle 
Python :: chromebook install pip 
Python :: pandas dataframe from dict 
Python :: min int python 
Python :: python what does yield do 
Python :: pandas read csv with index 
Python :: python copy file to another directory 
Python :: jupyter notebook change image size 
Python :: how to migrate from sqlite to postgresql django 
Python :: list to csv pandas 
Python :: rename multiple pandas columns with list 
Python :: python check if item in 2d list 
Python :: debugging pytest in vscode 
Python :: openpyxl font 
Python :: pandas datetime now 
Python :: 2 - 20 python 
Python :: how to make a python program to count from 1 to 100 
Python :: pandas groupby as new column 
Python :: plotly add hline dashed 
Python :: insert image to jupyter notebook 
Python :: python datetime yesterday 
Python :: select DF columns python 
Python :: find and replace string dataframe 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =