Convert SRE_Match object to string

Question:

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?

Asked By: Liondancer

||

Answers:

You should do it as:

result = re.search(your_stuff_here)
if result:
    print result.group(0)
Answered By: sshashank124

If you want to see all groups in order:

result = re.search(your_stuff_here)
if result:
    print result.groups()
Answered By: JOM
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.