May-31-2020, 03:30 AM
There are no literals. I just used "chars" in place of your "o".
You'd need to add in some conditional to handle the cases when the match doesn't succeed, and you might need to convert your object with characters to a string. But after that, the match is good.
You'd need to add in some conditional to handle the cases when the match doesn't succeed, and you might need to convert your object with characters to a string. But after that, the match is good.
def runlen(s, o): return re.search(fr"[^{o}]", s).span()[0]