Chopping off spaces at both ends

Kay Schluehr kay.schluehr at gmx.net
Sun Aug 7 13:14:33 EDT 2005


Use the strip() method.

Example:

>>> "\t abc    \n".strip()
"abc"

Variants are lstrip() and rstrip().

Regards,
Kay




More information about the Python-list mailing list