var = 'line1samplehere\r\nline2samplehere\r\nline3samplehere\r\n'
add = '12345'
I want to be able to search where '\r\n' is located and append the add string before that. I've researched and tried re.sub replacementre.sub(r'("\r\n"), add,var)
but obviously having errors. Any advice?