Jun-07-2018, 06:36 PM
Is there a way to create a saving mechanism inside a python file?
Self-taught HTML, CSS, Python, and Java programmer
Saving
|
Jun-07-2018, 06:36 PM
Is there a way to create a saving mechanism inside a python file?
Self-taught HTML, CSS, Python, and Java programmer
Jun-07-2018, 07:00 PM
(Jun-07-2018, 06:36 PM)Panda Wrote: Is there a way to create a saving mechanism inside a python file? What exactly do you mean by this? Please, elaborate
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Jun-08-2018, 12:23 PM
(Jun-07-2018, 07:00 PM)buran Wrote:As in a separate file that has things like(Jun-07-2018, 06:36 PM)Panda Wrote: Is there a way to create a saving mechanism inside a python file?What exactly do you mean by this? Please, elaborate start = True completed = False score = 10000
Self-taught HTML, CSS, Python, and Java programmer
Jun-08-2018, 12:37 PM
You can save your code as py file. Is that what you ask?
check https://python-forum.io/Thread-Basic-How...ython-code
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs (Jun-08-2018, 12:37 PM)buran Wrote: You can save your code as py file. Is that what you ask? check https://python-forum.io/Thread-Basic-How...ython-codeI don't think so. I would like a way to see how many times the program was started. No big deal, but that resets if it is in the file that is restarting. I would like a way to save it OUTSIDE of the file, so it can reach into the other file and get the EXACT number of times the program restarted. Edit: I don't know if it matters which extension the file has, because it doesn't really matter to me. Edit: As well as knowing the EXACT amount of times the program restarted, i want to store the amount of endings a player receives. Which means a TRUE or FALSE if the ending has already been found, and a number for the total of endings found.
Self-taught HTML, CSS, Python, and Java programmer
Jun-08-2018, 12:57 PM
You can save/update whatever information you want in a separate file or in a database every time when the program runs.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs (Jun-08-2018, 12:57 PM)buran Wrote: You can save/update whatever information you want in a separate file or in a database every time when the program runs.but how I know how to output to a file using logger, but i don't know how to get information from another file
Self-taught HTML, CSS, Python, and Java programmer
Jun-08-2018, 01:12 PM
Did you check the documentation?
https://docs.python.org/3/tutorial/input...ting-files or if you decide to use a sqlite DB https://docs.python.org/3/library/sqlite3.html
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs (Jun-08-2018, 01:12 PM)buran Wrote: Did you check the documentation? https://docs.python.org/3/tutorial/input...ting-files or if you decide to use a sqlite DB https://docs.python.org/3/library/sqlite3.htmlI did. It didn't help enough. The only thing i learned is f = open('save_file', 'w')writes to save_file.*, but i don't know how to write anything, or read it
Self-taught HTML, CSS, Python, and Java programmer
Jun-08-2018, 02:05 PM
you are kidding, right?
https://docs.python.org/3/tutorial/input...le-objects and https://docs.python.org/3/tutorial/input...-with-json if you want to use json (better, because you get structured data) there are numerous examples how to read and write to file Believe me, the sooner you learn to use the docs, the better
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs |
|