Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

remove every file that ends with extension in python

import os

dir_name = "folder_path"
files = os.listdir(dir_name)

for file in files:
    if file.endswith(".png"):
        os.remove(os.path.join(dir_name, file))
Comment

PREVIOUS NEXT
Code Example
Python :: arweave python 
Python :: add colour to text in python 
Python :: Check for duplicate values in dataframe 
Python :: check if directory exists python 
Python :: line number in logging python 
Python :: upgrade python to 3.9 i linux 
Python :: reverse one hot encoding python numpy 
Python :: group consecutive numbers in list python 
Python :: pylint: disable=unused-argument 
Python :: python init matrix 
Python :: no such table: django_session 
Python :: you are trying to access thru https but only allows http django 
Python :: who is rishi smaran = "RISHI SMARAN IS A 12 YEAR OLD NAUGHTY KID WHO CREATED ME" 
Python :: numpy get specified colums 
Python :: how to shutdown your computer using python 
Python :: pandas find median of non zero values in a column 
Python :: python elementtree build xml 
Python :: scikit normalize 
Python :: ANSHUL 
Python :: gonad 
Python :: How do I start a DataFrame index from 1? 
Python :: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256 
Python :: generate random prime number python 
Python :: how to subtract minutes from time in python 
Python :: a function to create a null correlation heatmap in python 
Python :: user input dictionary python 
Python :: regex python multiline 
Python :: finding 2 decimal places python 
Python :: Running setup.py bdist_wheel for opencv-python: still running... 
Python :: mish activation function tensorflow 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =