=> in Google Python Example -
so i'm new python , trying work through google python online class [https://developers.google.com/edu/python/regular-expressions]
i running python 2.7.5 , when try example has issues =>.
i've tried searching google explanations, have come empty. appreciated.
error message below.
sandbox$./re-test.py file "./re-test.py", line 8 match = re.search(r'iii', 'piiig') => found, match.group() == "iii" ^
code program :
#!/usr/bin/python import re ## search pattern 'iii' in string 'piiig'. ## of pattern must match, may appear anywhere. ## on success, match.group() matched text. match = re.search(r'iii', 'piiig') => found, match.group() == "iii" match = re.search(r'igs', 'piiig') => not found, match == none ## . = char \n match = re.search(r'..g', 'piiig') => found, match.group() == "iig" ## \d = digit char, \w = word char match = re.search(r'\d\d\d', 'p123g') => found, match.group() == "123" match = re.search(r'\w\w\w', '@@abcd!!') => found, match.group() == "abc"
the author using =>
describe result; not part of python syntax.
consider written following, intent may more clear:
match = re.search(r'iii', 'piiig') #=> found, match.group() == "iii"
Comments
Post a Comment