On Tuesday 09 February 2010 16:28:43 Ken G. wrote: > ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] > > I was using 'print mylist.rstrip()' to strip off the '\n' > > but kept getting an error of : > > AttributeError: 'list' object has no attribute 'rstrip'
A string has attribute rstrip not a list. You will need to loop over the list and update each item of the list with rstrip(). This, mylist = [s.rstrip('\n') for s in mylist], should do it. It might be that before making the list you did rstrip() on the individual strings..? Greets Sander _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor