Hello, I am looking for a method on how to properly load-in and edit small data storage files like .json or a .txt (I know data storage with json files is bad practice, I am working on MySQL implementation). Right now my application gets the main.py and .txt files from my GitHub repo’s. However, it is not able to edit any of these .txt files. How would I go about achieving what I want?
Thank you in advance!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
You should be able to do that with the standard Python modules like
osto read and write to the files.
You can read the file with:
To write to a file, you can use the
Note that if you are using the DigitalOcean App Platform, this will not work, as the storage there is ephemeral, meaning that you will loose all of your changes after each new build.
Feel free to share more details on your setup and I will be happy to advise you further!