Split a string in python taking care of quotes
Posted
by
santu
on Stack Overflow
See other posts from Stack Overflow
or by santu
Published on 2012-11-17T16:53:27Z
Indexed on
2012/11/17
17:00 UTC
Read the original article
Hit count: 274
I want to extract key value pairs of some form elements in a html page
for example
name="frmLogin" method="POST" onSubmit="javascript:return validateAndSubmit();" action="TG_cim_logon.asp?SID=^YcMunDFDQUoWV32WPUMqPxeSxD4L_slp_rhc_rNvW7Fagp7FgH3l0uJR/3_slp_rhc_dYyJ_slp_rhc_vsPW0kJl&RegType=Lite_Home"
is there any method using which I can safely get the key and value pairs. I tried using splitting by spaces and then using '=' characters but string inside quotes can also have '='.
is there any different kind of split method which can also take care of quotes?
© Stack Overflow or respective owner