I am struggling to convert a url to a nested tuple.

# Convert this string
str = 'http://somesite.com/?foo=bar&key=val'

# to a tuple like this:
[(u'foo', u'bar'), (u'key', u'val')]

I assume I need to be doing something like:

 url = 'http://somesite.com/?foo=bar&key=val'
 url = url.split('?')
 get = ()
 for param in url[1].split('&'):
     get = get + param.split('=')

What am I doing wrong? Thanks!

Edit
Report