Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Philipp Benning | f633d731b4 | |
Philipp Benning | f76c83b832 |
|
@ -0,0 +1,15 @@
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import seaborn as sns
|
||||||
|
|
||||||
|
plt.title('ChatGpt seine Lernkurve')
|
||||||
|
|
||||||
|
a = np.random.random((100,100))
|
||||||
|
|
||||||
|
plt.imshow(a)
|
||||||
|
|
||||||
|
plt.hot()
|
||||||
|
|
||||||
|
plt.colorbar()
|
||||||
|
|
||||||
|
plt.show()
|
63
s2_a3.py
63
s2_a3.py
|
@ -1,63 +0,0 @@
|
||||||
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<len(name)-1:
|
|
||||||
second_name = second_name + name[counter] + " "
|
|
||||||
counter += 1
|
|
||||||
|
|
||||||
# -1 to get the last elem of the list name
|
|
||||||
last_name = name[-1]
|
|
||||||
|
|
||||||
|
|
||||||
address = re.findall(r"(.+)([1-9]+).([\d]{5})(.+)", current_line[1])
|
|
||||||
address = address[0]
|
|
||||||
|
|
||||||
street_name = address[0]
|
|
||||||
house_number = address[1]
|
|
||||||
plz = address[2]
|
|
||||||
city = address[3]
|
|
||||||
|
|
||||||
geb_date = re.findall("([0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9][0-9])", current_line[2])
|
|
||||||
tel = re.findall("(\d{12,15})", current_line[3])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
person = {
|
|
||||||
"titel": titel[0],
|
|
||||||
"Vorname": first_name,
|
|
||||||
"Zweitname": second_name,
|
|
||||||
"Nachname": last_name,
|
|
||||||
"Straße": street_name,
|
|
||||||
"Hausnummer": house_number,
|
|
||||||
"PLZ": plz,
|
|
||||||
"Stadt": city,
|
|
||||||
"Geb.Datum": geb_date[0],
|
|
||||||
"Tel.": tel[0],
|
|
||||||
}
|
|
||||||
|
|
||||||
person_list.append(person)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
with open("Studienleistung2/Person_Neu.json", "w") as outfile:
|
|
||||||
json.dump(person_list, outfile, indent=2, ensure_ascii=False)
|
|
Loading…
Reference in New Issue