I have the following 2 variations of scraped data:
txt = '''Käuferprovision: 3 % zzgl. gesetzl. MwSt.''' # variation 1
and
txt = '''Käuferprovision: Die Courtage i.H.v. % 3,57 inkl. MwSt. ist''' # variation 2
I'd like to make one regular expression that gets the percentage as a float, so in the first instance 3.0 and in the second 3.57
I've tried this so far:
m = re.search(r'.{3}.%.{5}',txt)
txt = m.group().split("%")[1:]
txt = ("".join(txt)).replace(",",".")
print(txt)
Which works for the variation 2 but not variaton 1.