[Tutor] Type Error
Remco Gerlich
scarblac@pino.selwerd.nl
Wed, 20 Jun 2001 10:51:38 +0200
On 0, fasal.waseem@cis.co.uk wrote:
> Hi All
>
> Does anybody know where I can get hold of the document for python version
> 1.5, as I have to use that version and I keep having errors, and I would be
> very grateful if some one check why am I getting this error.
>
> line=string.split(string.strip(line),maxsplit=1)
> TypeError: this function takes no keyword arguments
>
> regards
http://www.python.org/doc/1.5/
In this case the closest translation would be
line = string.split(string.strip(line), " ", 1)
but that behaves slightly different; the original you have there splits on
blocks of whitespace, the translation on single spaces so e.g.
>>> string.split("whee whee")
['whee','whee']
>>> string.split("whee whee", " ")
['whee','','','whee']
That may or may not be a problem, depending on what your strings look like
(are there multiple spaces between the first word and the rest?)
--
Remco Gerlich