make a python program that serves as a database and that data is saved in a .txt document, in addition to the data being edited or deleted later
#idea 1 def get_data(name_of_the_file): file = open(name_of_the_file, 'r') text = file.read() file.close() return text.splitlines() def set_data(name_of_the_file, lines): file = open(name_of_the_file, 'w') file.write('\n'.join(lines)) file.close() def edit_data(name_of_the_file, index, new_line): lines = get_data(name_of_the_file) lines[index] = new_line set_data(name_of_the_file, lines) def delete_data(name_of_the_file, index): lines = get_data(name_of_the_file) lines.pop(index) set_data(name_of_the_file, lines)