I have been dealing with a little problem while programming python database. If I make new entry it will stay in the line with previous and I dont know where should I add \n or how could I make it in second line. Thanks for help. These are lines we are dealing with. #edit: using import json I am new to asking on stackoverflow, I dont think there are more data needed but if I made mistake I will place rest of code
def write_to_file(data):
with open('database.txt', 'w') as outfile:
json.dump(data, outfile)
def read_from_file():
with open('database.txt', 'r') as infile:
return json.load(infile)
def add_entry(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth):
data = read_from_file()
data.append({'id': first , 'titul': second, 'meno': third, 'priezvisko': fourth, 'ulica a cislo': fifth, 'mesto': sixth, 'psc': seventh, 'tlc': eighth, 'email': ninth})
write_to_file(data)
I tried adding \n to nearly every part of the code but nothing helped