Does anyone know how to replace all ocurences of '<\d+' regex with '\r\n<\d+', for example
"<20"
should be transformed to
"\r\n<20"
but
"> HELLO < asassdsa"
shuld be untouched
>>> import re
>>> str = "<20"
>>> output = re.sub(r'<(?=\d)', r'\r\n<', str)
>>> output
'\r\n<20'
str as a variable name, although I always fail to find a better name :(