Linking Dictionary Values
opengeometry at yahoo.ca
Fri Aug 24 17:04:15 CEST 2001
On Fri, Aug 24, 2001 at 09:31:44AM -0500, Maan M. Hamze wrote:
> Is it possible to link Dictionary values of each key into a text file? So
> the value of a key is a text file somewhere on the PC. And if so, how do I
> instruct Python to open the text file and print into screen when the key of
> the text file is used?
> Also, is it possible to link a value of a Dictionary key into a Python
> function/procedure? So, if the key is encountered, a way for the
> functionprocedure to be run.
Well, the dictionary value can be anything, like Fileobject or Function,
file = open('...')
dict = file
dict = func
If there are too many files open, which is determined at compile time,
you will get into trouble. I suggest just storing file name; you can
open/close the file only when you need the content.
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8 CPU cluster, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Sc.
More information about the Python-list