Answer the question
In order to leave comments, you need to log in
How to save data in python?
There is a certain variable, for example user_data = input()
It is necessary to save it somewhere, so that when you open the program again, it already exists. I do like this:
with open('file.txt', 'w') as file:
file.write(user_data)
user_data_list = []
with open('file.txt', 'r') as file:
for line in file:
user_data_list.append(line)
user_data = user_data_list[x]
Answer the question
In order to leave comments, you need to log in
Apparently, you have a list (or dictionary?) With users.
pickle -
json text - key : value
struct(name, age, mail, etc) - db: sqlite3, which doesn't need to be installed separately, mysql, postgresql, etc
But I think real programmers do things differently.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question