Why is it different from the example on the tutorial?

Rick Johnson rantingrickjohnson at gmail.com
Sun Jul 6 16:18:53 CEST 2014


On Sunday, July 6, 2014 8:38:41 AM UTC-5, rxj... at gmail.com wrote:
> When I get match result:
> py>pattern='abcd'
> py>prog = re.compile(pattern)
> py>string='abcd'
> py>result = prog.match(string)
> py>result
> <_sre.SRE_Match object at 0x6ffffeda5e0> 
> py>result.group(0)
> 'abcd'
> 
> It looks like 'result' is different from a simple
> 'counter' variable. I do not yet find the definition of
> 'result' object. What do you call 'result' object? Where
> can I find it (what topic would be in a tutorial)? Thanks,

One of the most powerful features of Python,,, for the
noob,,, be documentation strings. With Python you need not
buy expensive books, or venture into seedy and dangerous
alley ways of the inter-webs, no, all you need to do is do
that which any young and inexperienced lad would do when he
finds himself in a troubling situation:

    YELL FOR HELP!

The built-in function "help" will answer all your
questions,,, considering you ask the correct questions of
course!,,, but always remember the advice of a wise man and
don't become the "boy who cried wolf" one too many times!




More information about the Python-list mailing list