From ea7143df3ff16486b74d017bc1ed960b53ea6e6c Mon Sep 17 00:00:00 2001 From: MoritzLutz Date: Tue, 10 Jan 2023 12:48:52 +0100 Subject: [PATCH] s2_a3 --- s2_a3.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 s2_a3.py diff --git a/s2_a3.py b/s2_a3.py new file mode 100644 index 0000000..5d55972 --- /dev/null +++ b/s2_a3.py @@ -0,0 +1,63 @@ +import re +import json + + + +person_list = [] + +with open("Studienleistung2/Personen.txt") as input: + for lines in input: + current_line = lines.split(",") + + titel = re.findall(r"([A-Z][a-z]+\.)", current_line[0]) + + name = re.findall(r"([A-Z][a-z]+[^\.]*$)", current_line[0]) + name = re.split("\s", name[0]) + + # getting the fragments building the whole name + first_name = name[0] + + # if there are more than one second names + second_name = "" + counter = 1 + while counter