Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Deleting files which start with a name

my_dir = # enter the dir name
for fname in os.listdir(my_dir):
    if fname.startswith("version"):
        os.remove(os.path.join(my_dir, fname))
Comment

Deleting files which start with a name

import os, glob
for filename in glob.glob("mypath/version*"):
    os.remove(filename) 
Comment

PREVIOUS NEXT
Code Example
Python :: operation that returns True if all values are equal 
Python :: dataframe passed by reference or value 
Python :: pandas select only earliest event for duplicates 
Python :: python debugger online 
Python :: Kivy button on press call function with arguments 
Python :: convert pb to tb with python 
Python :: convert an image to matrix in python 
Python :: python set literal 
Python :: Sorted iteration 
Python :: bogo sort 
Python :: python list safely pop 
Python :: pivot_table indexing 
Python :: add halt for 10 seconds in selenium python 
Python :: find length of all G.keys() in dict 
Python :: keep only min entries in dataframe grouped by one column 
Python :: Slice Age in Python 
Python :: torch.tensor.expand 
Python :: COLLECTING 
Python :: dataset analysis in python photo photoelectric effect 
Python :: modbusfc03 python 
Python :: convert from python code to c++ code 
Python :: pandas sample frac 
Python :: plotly colors 
Python :: string -1 python 
Python :: print hello world 
Python :: python sort array by key 
Python :: mysql_python 
Python :: compute confusion matrix using python 
Python :: rename folder python 
Python :: prime numbers 1 to 100 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =