![]() |
Update a Module
Is there a way to update a variable in a module from the program that imported this module? So other programs importing this module later can also use the update.
|
Make the variable stored in a data file? Then the module will open the data file everytime it is loaded/called to use that variable?
|
You can use the shelve or pickle modules to maintain persistant variables. The __file__ variable contains the filepath of the currently executing module. Combine the two, and you could have something like:
:
import shelve |
| All times are GMT -5. The time now is 11:17 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC