Inside of Functions.py I define the function:
def subwords ():
global subwordsDL
subwordsDL = {'enjoy':['like', 'appreciate', 'love', 'savor'],
'hurt':['damage', 'suffering']}
print (subwordsDL)
Return
In my test code module, the code is:
global subwordsDL
from Functions import subwords
subwords ()
print (subwordsDL)
print (subwordsDL['enjoy'][2])
I get an error on the 4th line of this module (BTW, I tried this module with
and without the first line, reaffirming subwordsDL as global, and the
results are the same):
{'hurt': ['damage', 'suffering'], 'enjoy': ['like', 'appreciate', 'love',
'savor']}
Traceback (most recent call last):
File "test short.py", line 4, in <module>
print (subwordsDL)
NameError: name 'subwordsDL' is not defined
LOLworked on this for over an hour
Please help.
BIG SMILE...
Always, Dwight
--
https://mail.python.org/mailman/listinfo/python-list