[Tutor] string indexing

Keith Winston keithwins at gmail.com
Sun Jan 19 20:34:13 CET 2014


On Sun, Jan 19, 2014 at 11:33 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
>>>> help(''.find)
> Help on built-in function find:

Erm, getting what you want from help can be work.

Help(find)  #  doesn't work at all.

What Alan did above was create an empty string, by using two single
quotes next to each other ('', not to be confused with a single double
quote, "), and then seek Help on it's method "find" (methods are
accessed by following an object, in this case the empty string, with a
period, and the method name... in actual use there would be further
parenthesis, but for Help you don't use them)... hence

Help(''.find)

Also, Alan's really right on getting used to playing with bits and
pieces at the >>> prompt, you'll be amazed at how much you can do
there. Just don't try to write lengthy programs there, save those as
files and edit them separately.


-- 
Keith


More information about the Tutor mailing list