On 23 May 2012 11:07, Bala subramanian <[email protected]> wrote: > Hi, > I infact want write each of the item in the sliced list to a file.
You don't have any actual files in your program so I'm assuming by file you mean "each item is printed to standard output"? Anyway, you might try the following which is I think what you're trying to achieve.: N=100 myl=range(1,100+1) new=[] for i in range(0, len(myl),15): new.extend(myl[i:i+15]) for x in new: print x Ultimately the new list contains the same elements as the old list so by itself isn't very useful except to show that the split/slice and merge operations don't lose items/data from the original list. Walter _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
