[Tutor] how to split/partition a string on keywords?

akleider at sonic.net akleider at sonic.net
Fri Aug 24 03:08:44 CEST 2012


> On 23/08/12 23:08, akleider at sonic.net wrote:
>
>> (I often find myself wanting to hack in "off line environments" so
>> something as old fashion as a book would be nice:-)
>
> Depends how off line you are.
> If you still have the python interpreter then just using dir() and
> help() should be all you need.
>
> I couldn't recall how partition worked so I just typed
> help(''.partition) at the >>> prompt.
>
> Most documentation you need is available that way, and if in doubt try
> it out at the prompt!
>
> But if you mean offline as in only paper and pencil then a book is the
> best bet and Beazley is good. I use him and Python in a Nutshell for my
> paper-only moments.

Thank you for the tips.  I will definitely KEEP Beazley- we've developed a
very warm and cuddley relationship! (the Book, I mean:-)
I raised the issue out of concern that the 'partition' method wasn't there
and consequent worries that there may be other cool things I'm missing.
Ahh, Ha! as I type this I suddenly realize what you are getting at:
>>> s = "my string"
>>> s.dir()
<Result = exactly what I'm looking for!!!!!!!!>
Big "Thank You"
alex

>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>




More information about the Tutor mailing list