Newbie Question

Aaron Malone aaron at mancala.semo.net
Thu Apr 27 16:08:39 EDT 2000


Christian Tismer <tismer at tismer.com> writes:

> But if you want to be sure only to loose \n, and also might
> want to solve the problem that the list line might have no \n,
> you are better off with a loop, like so: (after reading)
> 
> for i in range(len(mylist)):
>     if mylist[i][-1:] == "\n":
>         mylist = mylist[:-1]

Correction:

for i in range(len(mylist)):
     if mylist[i][-1:] == "\n":
         mylist[i] = mylist[i][:-1]

-- 
Aaron Malone (aaron at semo.net)
System Administrator                     I can bend minds with my spoon.
Poplar Bluff Internet, Inc.
http://www.semo.net



More information about the Python-list mailing list