Comparing tuple elements against integers with Python
Question: I am having a hard time converting data. I select the data from my database,
which is returned in tuple format. I try to convert them using `list()`, but
all I get is a list of tuples. I am trying to compare them to integers which i
receive from parsing my JSON. What would be the easiest way to convert and
compare these two?

    
    
    from DBConnection import db 
    import pymssql
    from data import JsonParse
    
    db.execute('select id from party where partyid = 1')
    parse = JsonParse.Parse()
    
    for row in cursor:
        curList = list(cursor)
    
    i = 0 
    
    for testData in parse:
        print curList[i], testData['data']
        i += 1
    

Output:

    
    
    (6042,) 6042
    
    (6043,) 6043
    
    (6044,) 6044
    
    (6045,) 6045
    


Answer: Quick and dirty:

`print curList[i][0], testData['data']`

Or how about:

    
    
    for db_tuple, json_int in zip(cursor, parse):
       print db_tuple[0], json_int
    

