X-Received: by 10.66.121.200 with SMTP id lm8mr1521924pab.39.1404653921808; Sun, 06 Jul 2014 06:38:41 -0700 (PDT) X-Received: by 10.140.36.81 with SMTP id o75mr51586qgo.7.1404653921761; Sun, 06 Jul 2014 06:38:41 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!hn18no4014991igb.0!news-out.google.com!a8ni6411qaq.1!nntp.google.com!i13no6408906qae.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Sun, 6 Jul 2014 06:38:41 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=64.229.140.25; posting-account=SZ_svQkAAACWRFG2bDA-zgq8ILyl4-vo NNTP-Posting-Host: 64.229.140.25 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Why is it different from the example on the tutorial? From: rxjwg98@gmail.com Injection-Date: Sun, 06 Jul 2014 13:38:41 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.python:74014 On Sunday, July 6, 2014 8:54:42 AM UTC-4, Tim Chase wrote: > On 2014-07-06 05:13, rxjwg98@gmail.com wrote: > > > What I get on Python console: > > > > > > $ python > > > Python 2.7.5 (default, Oct 2 2013, 22:34:09) > > > [GCC 4.8.1] on cygwin > > > Type "help", "copyright", "credits" or "license" for more > > > information. > > > >>> import re > > > >>> p = re.compile('ab*') > > > File "", line 1 > > > p = re.compile('ab*') > > > ^ > > > SyntaxError: invalid syntax > > > >>> > > > > Are you sure that you copied/pasted that directly from the console > > instead of transcribing it with some mistake? > > > > I just did the same thing at the console and it worked perfectly > > fine > > > > $ python > > Python 2.7.3 (default, Mar 13 2014, 11:03:55) > > [GCC 4.7.2] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import re > > >>> p = re.compile('ab*') > > >>> > > > > > > -tkc Thanks. It did be caused by unclear copy&paste. I shall be careful in future. When I enter: >>>counter=100 >>>counter 100 When I get match result: >>>pattern='abcd' >>>prog = re.compile(pattern) >>>string='abcd' >>>result = prog.match(string) >>>result <_sre.SRE_Match object at 0x6ffffeda5e0> >>>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,