Hello,
selecting a record from a MySQL database results in a tuple like this:
(('Evelyn', 'Dog', 'No'),)
I want to assign every item of that tuple to a variable using this code (deep_list is taken from the Python Cookbook):

def deep_list(x):
    if type(x)!=type( () ):
        return x
    return map(deep_list,x)

mytuple = (('Evelyn', 'Dog', 'No'),)
mylist = deep_list(mytuple)
for item in mylist:
  name, pet, modified = item

it woks fine, but I wonder if there is a better way to achieve this.
Any suggestions?

thanks,
Dimitri
--
All truth passes through three stages. First, it is ridiculed. Second, it is violently opposed. Third, it is accepted as being self-evident.
Arthur Schopenhauer
-----

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to