Added regex to match with circles and corrected polygons regex
This commit is contained in:
parent
11fbb27fbb
commit
046c3d92da
12
fetch.py
12
fetch.py
@ -33,15 +33,21 @@ if __name__ == '__main__':
|
||||
# Make a the area
|
||||
for area in diclist:
|
||||
# Polygons
|
||||
if "polygone" in area["zone"]:
|
||||
lst = re.findall(".{0,35} ?:? ?.? ?: ?(\d{3}° \d{2}' \d{2},?\d{0,2}” .) ?\/ ?(\d{2}° \d{2}' \d{2},?\d{0,2}” .)", area["zone"])
|
||||
if "polygone" in area["zone"] or "Polygone" in area["zone"]:
|
||||
lst = re.findall(".{0,35} ?:? ?.? ?: ?(\d{1,3}° \d{2}' \d{2},?\d{0,2}(?:\"|”) .) ?\/ ?(\d{1,3}° \d{2}' \d{2},?\d{0,2}(?:\"|”) .)", area["zone"])
|
||||
area["zone"] = lst
|
||||
del lst
|
||||
elif "cercle" in area["zone"] or "Cercle" in area["zone"]:
|
||||
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()
|
||||
area["zone"] = lst
|
||||
print(lst)
|
||||
del lst
|
||||
|
||||
# Print the dict (keep this code in the end of the file)
|
||||
print("===== Dict =====")
|
||||
for index, area in enumerate(diclist):
|
||||
if index == 129:
|
||||
print(f"\n-------------{index}----------------\n")
|
||||
for element in area:
|
||||
print(f" {element}: {diclist[index][element]}")
|
||||
print("\n")
|
Loading…
Reference in New Issue
Block a user