Printing the first value in an array instead of just the first letter? (Python) -


i have used python append data sqlite3 database array. have array, trying print appended data in format along lines of:

print "team: " + new_array[0][0] + " score: " + new_array[0][1] + " overall: " + new_array[0][2] 

the code have okay this. however, trying create loop using counter print of data array in above format.

the problem when try create loop , print first value in array, first letter of value printed. example:

    print new_array[0] 

... print:

    team_6     team_3     team_5     team_1     team_2     team_4 

... and...

    print new_array[0][0] 

... print:

    t     t     t     t     t     t 

this have far: import sqlite3

    new_array = []      conn = sqlite3.connect('league.db')     c = conn.cursor()      game = c.execute("select team,score,overall league order overall desc")     items in game:         new_array.append(items)      print new_array[0][0] 

the code above print out 'team_6' should. however, problem of printing 't's occurs when create loop.

your appreciated. thanks.

try expected output

for items in game.fetchall():     print items[0] # should `team6` , on 

if want put in array.do this

for items in game.fetchall():     new_array.append(items)  >>>new_array[0][0] 'team6' 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -