Translating a Perl script into Python

Pete Shinners shredwheat at mediaone.net
Sat Jan 20 14:14:42 EST 2001


"Sheila King" <sheila at thinkspot.net> wrote
> OK, so I decided to try this out on my host.
> Running their install of Python (1.5.1):
>
> Python 1.5.1 (#1, Sep  3 1998, 22:51:17)  [GCC 2.7.2.3] on linux-i386
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> qmail="SENDER RECIPIENT EXT HOST".split()
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> AttributeError: 'string' object has no attribute 'split'
> >>>


adding the string operations as members of string objects happened
after python 1.5.2. going with python1.5 you need to import the
string module and use the split function from that.

>>> import string
>>> qmail = string.split('SENDER RECIPIENT EXT HOST')







More information about the Python-list mailing list