Monday, August 22, 2022

Persistence

 New week; and I have been looking at creating and writing

to file in Python. I have created a file called CallEvents.txt programmatically.

                                                             


                                                                       


I closed and reopened the project, and everything is still there. Because that is the 

problem with the Calendar project, at this point. setting something up that persists.

https://www.w3schools.com/python/python_file_handling.asp

                                                   *     *     *

So now - thanks to some helpful code from the Web - I can get the date

from the event, and vice-versa. (Assuming, I am entering the event date, and 

the event name on different lines).  I can see deleting entries, or replacing them. 

Maybe there is a way to handle multiple entries with this capability)...                                                             



                                                                              



                                                          *     *     *
a more straightforward approach is built-in frpython: sqlite databases.
 
There is an sqlite3 module one merely iports and uses. Below, from a tutorial,

I have created a database called 'text.db' and added records to it, which can be listed

I am noe free to condsult the db, and make changes to it.

                                                            


So where is this db, physically, in my computer. Interesting question. If one

tries to find ot, one is told it is a unreachable system file.

                                                                    

Doesn't augur well to packaging a db with our calendar ‽




No comments: