Newbie Question
Christian Tismer
tismer at tismer.com
Tue May 2 15:31:51 EDT 2000
Aaron Malone wrote:
>
> 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]
Sure, sorry. The code was tested by the "brain interpreter"
only, which is much too much forgiving :-)
--
Christian Tismer :^) <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship* http://starship.python.net
14163 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
where do you want to jump today? http://www.stackless.com
More information about the Python-list
mailing list