SyntaxFix
Write A Post
Hire A Developer
Questions
I'd go with:
r = re.search("\d+", ch) result = return r.group(0) if r else ""
re.search only looks for the first match in the string anyway, so I think it makes your intent slightly more clear than using findall.
re.search
findall