I have a data string from an HTML form using the GET method as below, the string obtained by the Python script os.environ.get('QUERY_STRING')
name=sam&comment=sam+comment&answer=red&question_no=3&submit=Submit
Can anyone give me some guidance as to how to parse this string in Python so I can have a variable 'name 'with value 'sam', variable 'comment ' with value 'sam comment' etc? My first thoughts are to read each character in turn until I find a separating character (eg = or &) and then extract the data that follows. is there an easier way?
name=sam&comment=sam+comment&answer=red&question_no=3&submit=Submit
Can anyone give me some guidance as to how to parse this string in Python so I can have a variable 'name 'with value 'sam', variable 'comment ' with value 'sam comment' etc? My first thoughts are to read each character in turn until I find a separating character (eg = or &) and then extract the data that follows. is there an easier way?
Statistics: Posted by Duggieb — Mon Oct 13, 2025 7:07 pm