pfad verbessert

Main
kevin 2023-01-10 13:29:30 +01:00
parent e0fa295a64
commit 2080b12101
4 changed files with 9 additions and 4 deletions

2
SL2/Name.txt 100644
View File

@ -0,0 +1,2 @@
Dr. Oleg Alman, In der Ostukraine 12 61823 Euskirchen, 01.01.1999, 0123456789
dennis krämer, straße 1 63303 dreieich, 01.10.1999, 21414134341

View File

@ -0,0 +1 @@
[{"Index": 1, "Titel": "Dr.", "Vorname": "Oleg", "Zweitname": null, "Nachname": "Alman", "Geburtsdatum": ["01.01.1999"], "Strasse": "In der Ostukraine ", "Hausnummer": ["12"], "PLZ": ["61823"], "Wohnort": "Euskirchen", "Rufnummer": ["0123456789"]}, {"Index": 2, "Titel": null, "Vorname": "dennis", "Zweitname": null, "Nachname": "kr\u00c3\u00a4mer", "Geburtsdatum": ["01.10.1999"], "Strasse": "stra\u00c3\u0178e ", "Hausnummer": ["1"], "PLZ": ["63303"], "Wohnort": "dreieich", "Rufnummer": ["21414134341"]}]

Binary file not shown.

View File

@ -1,10 +1,11 @@
import re import re
import json import json
text_file = open(r"C:\Users\denni\Documents\Bundeswehr\HSMA\PR3\Steinberger\SL2\Name.txt", "r") text_file = open(r"Name.txt", "r")
data = text_file.readlines() data = text_file.readlines()
arr = [None] * len(data) arr = [None] * len(data)
counter = 1 counter = 1
text_file.close()
for line in data: for line in data:
@ -42,7 +43,6 @@ for line in data:
adresse_array = re.split("\s", adresse) adresse_array = re.split("\s", adresse)
plz = re.findall("\d{5}", adresse) plz = re.findall("\d{5}", adresse)
hausnummer = re.findall(r"\b\d{1,4}\b", adresse) hausnummer = re.findall(r"\b\d{1,4}\b", adresse)
# strasse = re.findall(r"\b[A-Z]",adresse)
chars = re.split("\d",adresse) chars = re.split("\d",adresse)
strasse = chars[0] strasse = chars[0]
ort = adresse_array[len(adresse_array)-1] ort = adresse_array[len(adresse_array)-1]
@ -68,5 +68,7 @@ for line in data:
counter = counter + 1 counter = counter + 1
with open(r"C:\Users\denni\Documents\Bundeswehr\HSMA\PR3\Steinberger\SL2\PersonNeu.json", "w") as f: with open(r"PersonNeu.json", "w") as f:
json.dump(arr,f) json.dump(arr,f, indent=1, ensure_ascii=False)
f.close()