In a directory I will have any number of files. All of the file names will contain 'R1' or 'R2', 'R3' etc within. for example thisfile_R1.csv. The 'R' numbers in this directory will not always be consistent, so sometime the lowest may be 'R3' and run sequentially to 'R15'.
I need a way for python to start at the lowest integer of the R* files in the directory, then loop through to the last 'R' integer, as a way to edit files from lowest to highest, sequentially.
procdir = r"C:\Users\processed"
collected = os.listdir(procdir)
for f in collected:
#if fnmatch.fnmatch(f, '*R*.csv'):
if "R*.csv" in collected: