diff --git a/SL2/Name.txt b/SL2/Name.txt new file mode 100644 index 0000000..28b3457 --- /dev/null +++ b/SL2/Name.txt @@ -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 \ No newline at end of file diff --git a/SL2/PersonNeu.json b/SL2/PersonNeu.json new file mode 100644 index 0000000..3ab258e --- /dev/null +++ b/SL2/PersonNeu.json @@ -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"]}] \ No newline at end of file diff --git a/SL2/__pycache__/s2_a3.cpython-310.pyc b/SL2/__pycache__/s2_a3.cpython-310.pyc new file mode 100644 index 0000000..db438fe Binary files /dev/null and b/SL2/__pycache__/s2_a3.cpython-310.pyc differ diff --git a/SL2/s2_a3.py b/SL2/s2_a3.py index 2532b68..5e770a3 100644 --- a/SL2/s2_a3.py +++ b/SL2/s2_a3.py @@ -1,10 +1,11 @@ import re 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() arr = [None] * len(data) counter = 1 +text_file.close() for line in data: @@ -42,7 +43,6 @@ for line in data: adresse_array = re.split("\s", adresse) plz = re.findall("\d{5}", adresse) hausnummer = re.findall(r"\b\d{1,4}\b", adresse) - # strasse = re.findall(r"\b[A-Z]",adresse) chars = re.split("\d",adresse) strasse = chars[0] ort = adresse_array[len(adresse_array)-1] @@ -68,5 +68,7 @@ for line in data: counter = counter + 1 -with open(r"C:\Users\denni\Documents\Bundeswehr\HSMA\PR3\Steinberger\SL2\PersonNeu.json", "w") as f: - json.dump(arr,f) \ No newline at end of file +with open(r"PersonNeu.json", "w") as f: + json.dump(arr,f, indent=1, ensure_ascii=False) + +f.close() \ No newline at end of file