TypeError: expected string or bytes-like objectExample with error code:
num_list = re.findall(r"[-+]?\d*\.\d+|\d+", txt)You can convert the argument as str if you want use int function:
return int(num_list[0])
num_list = re.findall(r"[-+]?\d*\.\d+|\d+", txt)Reference:
return int(str(num_list[0]))
https://stackoverflow.com/questions/43727583/re-sub-erroring-with-expected-string-or-bytes-like-object
No comments :
Post a Comment