I type the following sample codes on Python, but it echoes differently.

Regular expressions are compiled into pattern objects, which have methods for
various operations such as searching for pattern matches or performing string

>>> import re
>>> p = re.compile('ab*')
>>> p  
<_sre.SRE_Pattern object at 0x...>

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 "<stdin>", line 1
    p = re.compile('ab*')
SyntaxError: invalid syntax


Reply via email to