Stripping new lines from strings?
thehaas at my-deja.com
thehaas at my-deja.com
Thu Aug 24 23:59:49 EDT 2000
More information about the Python-list mailing list
Thu Aug 24 23:59:49 EDT 2000
- Previous message (by thread): Stripping new lines from strings?
- Next message (by thread): Stripping new lines from strings?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <31575A892FF6D1118F5800600846864D5B105A at intrepid>, Simon Brunning <SBrunning at trisystems.co.uk> wrote: > > From: Matthew Schinckel [SMTP:matt at null.net] > > What about using re: > > > > re.sub("\n$", '', str) > > Oh please, let's not make things complicated . . . str = str[:-1] Although you have to be sure that the last char is a \n, because it will take off whatever the last char is. Sorta like chop(str) in Perl. Mike Sent via Deja.com http://www.deja.com/ Before you buy.
- Previous message (by thread): Stripping new lines from strings?
- Next message (by thread): Stripping new lines from strings?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list