Ken G. wrote:
I printed out some random numbers to a list and use 'print mylist' and
they came out like this:
['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'
rstrip is a string method, not a list method. You must apply it to each
element in the list. One way is:
print [item.rstrip() for iten in mylist]
--
Bob Gailer
919-636-4239
Chapel Hill NC
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor