I have some strings look like: *.rem.1.gz and *.rem.2.gz
And I want to replace it into *.1.trim.gz and *.2.trim.gz
The number 1 and number two files are paired with each other, which I want to create a separate string to include both files at once.
import os
allfiles = os.listdir
pair = [x.replace("rem.(d+)","(d+).trim")for x in allfiles] ##obviously this doesn't work but just want to give an idea what I want to do!
Thanks for the help!