Peter Jessop wrote: > Kent > > Thanks for your reply. > The structure is for sending form variables and values to a web server > with POST. > I am using urllib.urlencode which accepts a list or dictionary as argument. > > The idea is to look for airline tickets. > The airline I buy from only lets me search by data but I want to > automate the process by POSTing the form for a range of dates so that > effectively I can search by price not by date. > I will then parse the returned HTML using HTMLParser or BeautifulSoup. > > The form has a large number of variables and I just want to find a > tidy way to organise the information.
It sounds like you should use a dictionary directly as your primary data structure. For data that is fixed just use a literal dictionary, for example args = dict(origin='SJO', destination='MHO') For dates, you presumably have some kind of loop to generate dates in a range, then insert them into the dict: for date in <list of dates>: args['date'] = date # fetch and parse the URL with args as the POST data Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor