Can Anyone Help me on this

Peter Hansen peter at engcorp.com
Thu Nov 3 16:44:16 EST 2005


blah at blah.blah wrote:
> i m trying to reverse the order in which the
> strings are stored in list
> 
> then pop it into another list
> 
> what m i doin worng??
> 
> here's the code:
> 
> list1 = []
> list2 = []
> list1.extend('123456789')

How about this instead (Python 2.4 or later):

list2 = list(reversed('123456789'))

-Peter



More information about the Python-list mailing list