Hi, My bad - PEBKAC - didn't read the docs properly.
I need to use urlparse.urlparse() to extract the query first. So for anybody searching this, you can use something liek: In [39]: url Out[39]: 'https://www.foo.com/cat/dog-13?utm_source=foo1043c&utm_medium=email&utm_campaign=ba^Cn=HC' In [40]: urlparse.parse_qs(urlparse.urlparse(url).query) Out[40]: {'utm_campaign': ['ba^Cn=HC'], 'utm_medium': ['email'], 'utm_source': ['foo1043c']} Cheers, Victor On Wednesday, 30 October 2013 09:34:15 UTC+11, Victor Hooi wrote: > Hi, > > > > I'm attempting to use urlparse.parse_qs() to parse the following url: > > > > > https://www.foo.com/cat/dog-13?utm_source=foo1043c&utm_medium=email&utm_campaign=ba^Cn=HC > > > > However, when I attempt to parse it, I get: > > > > {'https://www.foo.com/cat/dog-13?utm_source': ['foo1043c'], > > 'utm_campaign': ['ba^Cn=HC'], > > 'utm_medium': ['email']} > > > > For some reason - the utm_source doesn't appear to have been extracted > correctly, and it's keying the result on the url plus utm_source, rather than > just 'utm_source'? > > > > Cheers, > > Victor -- https://mail.python.org/mailman/listinfo/python-list