0

I am trying to figure out if there is a way to save data in python so that I can use it again if I close VS Code.

For example:

fruit = input("What is your favorite fruit?")

Let's say that the user inputs "apple". Is there a way for me to save that information in VS code so that when I close and open the application, the code will still remeber that the user's favorite fruit is apple?

I haven't tried anything yet because my Python knowledge is very limited. If someone could please explain this to me and explain all the functions needed like I am 5 years old, that would be great.

InSync
  • 4,851
  • 4
  • 8
  • 30
  • 2
    Write it to a file, then read the file when needed. https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files – MattDMo May 25 '23 at 21:59
  • ^ or if you want to do this for multiple users, a database like SQLite (desktop) or MySQL (server) – Dave S May 25 '23 at 22:05

0 Answers0