Perl chop equivalent in Python?
Harald Hanche-Olsen
hanche at math.ntnu.no
Wed May 31 14:53:22 EDT 2000
+ pem at my-deja.com:
| Is there an equivalent command to chop (the perl command) in Python?
| If not, is there some easy way to use existing commands to do this
| simple task? I need to do it frequently and would like to have a
| readily available command that does not require much programming.
line = line[:-1]
Sometimes, line = string.rstrip(line) is more appropriate.
You be the judge of that.
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- "There arises from a bad and unapt formation of words
a wonderful obstruction to the mind." - Francis Bacon
More information about the Python-list
mailing list