How does this line of code work? Google searches on individual characters don't work well.
re.sub(r'(.*>.*/.*)%s(_R[12].*)' % sample.group(1), r'\1%s\2' % sample_name[1], line)
What I don't understand:
"% sample.group(1)"
.... what is % doing?'\1%s\2' %
%s
What I understand:
- re.sub(x,y,z) will substitute x for y in string z
- r is for raw (don't mess with /)
- arrays & indexes
_R[12].*
matches "_R" and a 1 or 2 followed by random characters.- line (it's a string)
Thanks!