A.M <[EMAIL PROTECTED]> wrote: >The other problem is accessing data in each row by column name. In Ruby I >can say: > >Print row["ColName"] > >In Python; however, I must access to row contents by integer index, like >PRINT ROW[0], which reduces my program's readability. > >Can I access to row's contents by column name?
columns = dict((name, col) for col, name in enumerate(cursor.description)) print row[columns["ColName"]] And please don't top-post. -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | "Frankly I have no feelings towards penguins one way or the other" \X/ | -- Arthur C. Clarke her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- http://mail.python.org/mailman/listinfo/python-list