The output of my re.search returns <_sre.SRE_Match object at 0x10d6ed4e0> I was wondering how could I convert this to a string? or a more readable form?
re.search() tells you whether the regex matches the string.
- devnull
2 Answers
32
votes
You should do it as:
result = re.search(your_stuff_here)
if result:
print result.group(0)
6
votes
If you want to see all groups in order:
result = re.search(your_stuff_here)
if result:
print result.groups()
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more
re.search()tells you whether the regex matches the string. - devnull