[EMAIL PROTECTED] 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') > > print list1 > > for a in list1: > list2 = list1.pop() > > print list2 > -- > * Posted with NewsLeecher v3.0 Beta 7 > * http://www.newsleecher.com/?usenet
well, mant things are happening, so many it's not clear to me what you're trying to do... BUT, considering your for statement, since you are poping elements out of list you are shortening it, so you are only getting as far as element '5' If what you want is a reversed copy, you could just append list1 elements to list2, and use the reverse function such as >>> ... >>> for i in list1: ... list2.append(i) ... >>> list2.reverse() >>> list1 ['1', '2', '3', '4', '5', '6', '7', '8', '9'] >>> list2 ['9', '8', '7', '6', '5', '4', '3', '2', '1'] -- http://mail.python.org/mailman/listinfo/python-list