Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python check if folder is empty

if not os.listdir('/home/varun/temp') :
    print("Directory /home/varun/temp is empty")
Comment

empty directory if not empty python

'''
    Check if a Directory is empty : Method 1
'''    
if len(os.listdir('/home/varun/temp') ) == 0:
    print("Directory is empty")
else:    
    print("Directory is not empty")
Comment

python check if folder is empty

import glob
if not glob.glob(f"/path/to/dir/*"):
	print("Dir is empty")
Comment

PREVIOUS NEXT
Code Example
Python :: load custom font pygame 
Python :: delete element of a list from another list python 
Python :: generate python date list 
Python :: how to get input in tkinter 
Python :: pandas_datareader 
Python :: pandas series values into strings 
Python :: python print float in scientific notation 
Python :: python get all folders in directory 
Python :: python install required packages 
Python :: pil get image size 
Python :: python tkinter filedialog folder 
Python :: timedelta year python 
Python :: python diamond print 
Python :: min int python 
Python :: discord.py set activity 
Python :: n random numbers python 
Python :: python - remove scientific notation 
Python :: dictionary sort python 
Python :: name unnamed column pandas 
Python :: set window size tkinter 
Python :: run JupyterLab 
Python :: sort a dataframe by a column valuepython 
Python :: pip version command 
Python :: making spark session 
Python :: python cmd colors 
Python :: matplotlib legend 
Python :: discord.py play mp3 file 
Python :: pyttsx3 pip 
Python :: python get webpage source 
Python :: types of all columns pandas 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =