Stripping new lines from strings?

CHRIS unk at unk.ororr
Tue Aug 15 02:57:15 EDT 2000


What is the best (fastest) way to strip new line characters from a
string in Python? In C I would do:

char *p;
p = strchr(str, '\n');
if(p)
  *p = '\0';

/* repeat process for '\r' character */


Thanks.




More information about the Python-list mailing list