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

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -