[cse491] parse_qs

C. Titus Brown ctb at msu.edu
Tue Sep 23 16:35:19 PDT 2008


On Tue, Sep 23, 2008 at 07:27:18PM -0400, Brett Thomas Mcmillen wrote:
-> Im using the the cgi function to parse the 
-> 
-> "name=test&name=test2&blah=foo" query string and I get 
-> 
-> {'blah': ['foo'], 'name': ['test', 'test2']} 
-> 
-> My question is how do I know how long the query string is going to be? For 
-> instance a parsed query string could look like this: 
-> 
-> {'yo': ['fool'], 'name': ['test', 'test2', 'test3', 'test4'......etc]} 

Hi, Brett,

parse_qs returns a dictionary.  So you can just do a 'len' on it.

The values in the returned dictionary are lists of the form values.

--t
-- 
C. Titus Brown, ctb at msu.edu



More information about the cse491-fall-2008 mailing list