How I can save data.. and closing the code... later go to the same code and show the data saved? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How I can save data.. and closing the code... later go to the same code and show the data saved?

In Any language

30th Mar 2019, 12:39 AM
David Mendez
David Mendez - avatar
5 Answers
+ 10
You can't do that on Codeplayground. As to how it's done in various languages why not have a look at the language tutorials.
30th Mar 2019, 12:50 AM
Sonic
Sonic - avatar
+ 2
Basically saving to a file is similar to printing to a screen or paper. In fact "print" is print due to the original method of a computer to display results. It would print to paper. Nowadays print is not as easy. You must print to a file, screen, or printer each has its own way. You've asked about data storage in any language. In python you must first open a file in write mode. Then you can write to the file. The file will generally be text, but can be numbers or a mix. It's a good idea to devise how you want your data to be stored and reserve the space in the file ahead of time. For specific information on how exactly to create, and open files. In python refer to the python information page. Search for file access or read/write. Each language will have its own methods and they vary widely. The second part of your question is a bit tricky. Storing data within a code is easy if the data is static. If not then data must be stored in a file. Unless your code rewrites the static values by overwriting...
31st Mar 2019, 3:40 AM
Michael Williams
Michael Williams - avatar
0
Thanks for the answer... I will try to make these
30th Mar 2019, 10:28 AM
David Mendez
David Mendez - avatar
0
Cont. The existing data within the code. In any language that requires predefined variables prior to use, you can. It would then save itself with the new values. Very involved and wasteful to do that. So much easier to extract from a data file and modify it on the fly.
31st Mar 2019, 3:49 AM
Michael Williams
Michael Williams - avatar
- 2
Mmm I had seen many on internet... but I hadn't find something about save data... like a page... with users... documents... etc...
30th Mar 2019, 1:17 AM
David Mendez
David Mendez - avatar