Chopping off spaces at both ends
Tim Roberts
timr at probo.com
Tue Aug 9 00:21:02 EDT 2005
Madhusudan Singh <spammers-go-here at spam.invalid> wrote:
>
> I am a newbie to python and am using it to interface some of my lab
>equipment.
>
> How does one get rid of spaces at both ends of a string ? A little like the
>trim() intrinsic in fortran 95.
>
> One of my instruments is returning a string that has one or more blanks in
>it, and that is complicating string matching tests in one of my functions.
>>> a = ' abc '
>>> print a.strip()
'abc'
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list