Transformed m to float

This commit is contained in:
TheDevKiller 2018-11-11 16:29:00 +01:00
parent 6197d16d56
commit 9e75a71ab9

View File

@ -80,6 +80,8 @@ def fetch(url='https://www.legifrance.gouv.fr/eli/arrete/2018/10/12/PRMD1824595A
lst[0] = list(re.search(r"(.{6}) .{0,5}?(\d{1,3},?\d{0,2} ?.{1,2}) .{1,35} ?(\d{3}° \d{1,2}' \d{1,2}” .) ?\/ ?(\d{1,3}° \d{1,2}' \d{1,2}” .)", area["zone"], re.S).groups()) lst[0] = list(re.search(r"(.{6}) .{0,5}?(\d{1,3},?\d{0,2} ?.{1,2}) .{1,35} ?(\d{3}° \d{1,2}' \d{1,2}” .) ?\/ ?(\d{1,3}° \d{1,2}' \d{1,2}” .)", area["zone"], re.S).groups())
if "km" in lst[0][1]: if "km" in lst[0][1]:
lst[0][1] = float(re.search("(\d*,?\d*).*", lst[0][1]).groups()[0].replace(",", "."))*1000 lst[0][1] = float(re.search("(\d*,?\d*).*", lst[0][1]).groups()[0].replace(",", "."))*1000
else:
lst[0][1] = float(re.search("(\d*,?\d*).*", lst[0][1]).groups()[0].replace(",", "."))
lst[0][2] = dms2dd(lst[0][2]) lst[0][2] = dms2dd(lst[0][2])
lst[0][3] = dms2dd(lst[0][3]) lst[0][3] = dms2dd(lst[0][3])
area["zone"] = lst area["zone"] = lst
@ -97,7 +99,6 @@ if __name__ == '__main__':
# Print the dict (keep this code in the end of the file) # Print the dict (keep this code in the end of the file)
print("===== Dict =====") print("===== Dict =====")
for index, area in enumerate(diclist): for index, area in enumerate(diclist):
if index == 129:
print(f"\n-------------{index}----------------\n") print(f"\n-------------{index}----------------\n")
for element in area: for element in area:
print(f" {element}: {diclist[index][element]}") print(f" {element}: {diclist[index][element]}")