import re import json #this is a test comment 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