Converted km to m
This commit is contained in:
parent
1231c201b6
commit
3e7a04fb14
15
fetch.py
15
fetch.py
@ -76,13 +76,15 @@ def fetch(url='https://www.legifrance.gouv.fr/eli/arrete/2018/10/12/PRMD1824595A
|
|||||||
del lst
|
del lst
|
||||||
# Circles
|
# Circles
|
||||||
elif "cercle" in area["zone"]:
|
elif "cercle" in area["zone"]:
|
||||||
lst = [()]
|
lst = [[]]
|
||||||
lst[0] = 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]:
|
||||||
|
lst[0][1] = float(re.search("(\d*,?\d*).*", lst[0][1]).groups()[0].replace(",", "."))*100
|
||||||
area["zone"] = lst
|
area["zone"] = lst
|
||||||
del lst
|
del lst
|
||||||
# Atolls
|
# Atolls
|
||||||
elif area["zone"].strip() == "atolls et eaux territoriales incluses":
|
elif area["zone"].strip() == "atolls et eaux territoriales incluses":
|
||||||
area["zone"] = [("cercle", "35KM", "138.9022", "21.82917"), ("cercle", "27KM", "138.7425", "22.23528A")]
|
area["zone"] = [("cercle", 3500.0, "138.9022", "21.82917"), ("cercle", "27KM", "138.7425", "22.23528A")]
|
||||||
return diclist
|
return diclist
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +95,8 @@ 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):
|
||||||
print(f"\n-------------{index}----------------\n")
|
if index == 86:
|
||||||
for element in area:
|
print(f"\n-------------{index}----------------\n")
|
||||||
print(f" {element}: {diclist[index][element]}")
|
for element in area:
|
||||||
|
print(f" {element}: {diclist[index][element]}")
|
||||||
print("\n")
|
print("\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user