Store and recall a variable in a text file Python -


How do I store variable x in a text file on a specific row (first) and retrieve it as the program opens is .

In addition, how do I store data in a text file on a specific line

< P> You should take a look at open () .

  To write a file: Open with ("file.txt", "w") as f: write f.write ("data!") # From the file For: open ("file.txt", "r") with f: print (f.read ())  

Next time, you should check the duplicate:

,.


Comments