Reversing a List

Victor Subervi victorsubervi at gmail.com
Wed Sep 1 09:00:03 EDT 2010


Hi;
I have this code:

  cursor.execute('describe products;')
  cols = [item[0] for item in cursor]
  cols = cols.reverse()
  cols.append('Delete')
  cols = cols.reverse()

Unfortunately, the list doesn't reverse. If I print cols after the first
reverse(), it prints None. Please advise. Also, is there a way to append to
the front of the list directly?
TIA,
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100901/dcfa9524/attachment.html>


More information about the Python-list mailing list