python - Grab what is after f1= but ignore \r\n and \n if they are present -


currently use this:

a = re.search(r'(?<=f1=)(.*)',a) 

to string after f1=. string looks this

 f1=test string \r\n  or   f1=test string \n 

in other words if there such thing

\n or \r\n 

i avoid parsing them mistake aren't present.

try

a = re.search(r'(?<=f1=)(.*)', a.strip()) 

strip() remove trailing spaces , line feeds.


Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -