[Tutor] unable to use find(), index()

Walter Prins wprins at gmail.com
Thu Dec 8 12:36:14 CET 2011


Hi Surya,

On 8 December 2011 11:19, surya k <suryak at live.com> wrote:
>
> >>>astr.find(str1, beg=0, end=3)
> This is showing the following error
> Traceback (most recent call last):  File "<interactive input>", line 1, in
> <module>TypeError: find() takes no keyword arguments
>

See the documentation for the str.find() method here:
http://docs.python.org/release/2.5.2/lib/string-methods.html

The error says that find() does not take any keyword arguments, and you've
supplied 2, (namely, "beg" and "end".) So, try calling find() without
trying to specify beg and end as keyword (e.g. named as you've done)
arguments.

Also read up on keyword arguments (and arguments in general):
http://docs.python.org/release/1.5.1p1/tut/keywordArgs.html

Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111208/17b5fcb3/attachment.html>


More information about the Tutor mailing list