„SL2/s2_a3.py“ ändern
parent
588529032e
commit
fc34a84e3b
|
@ -4,12 +4,13 @@ import string
|
|||
|
||||
text_file = open(r"Personen.txt", "r")
|
||||
data = text_file.readlines()
|
||||
|
||||
arr = [None] * len(data)
|
||||
counter = 1
|
||||
text_file.close()
|
||||
|
||||
for line in data:
|
||||
|
||||
try:
|
||||
data_array = re.split(",", line)
|
||||
name = data_array[0]
|
||||
name_array = re.split("\s",name)
|
||||
|
@ -72,7 +73,8 @@ for line in data:
|
|||
|
||||
arr[counter - 1] = person
|
||||
counter = counter + 1
|
||||
print(counter)
|
||||
except:
|
||||
continue
|
||||
|
||||
with open(r"PersonenNeu.json", "w") as f:
|
||||
json.dump(arr,f, indent=1, ensure_ascii=False)
|
||||
|
|
Loading…
Reference in New Issue