Jun-07-2018, 06:36 PM
Pages: 1 2
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
Jun-08-2018, 12:23 PM
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
check https://python-forum.io/Thread-Basic-How...ython-code
Jun-08-2018, 12:54 PM
(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.
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.
Jun-08-2018, 01:09 PM
(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
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
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
Jun-08-2018, 02:00 PM
(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
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
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
Pages: 1 2