Global command doesn't seem to work...

Dwight GoldWinde Dwight at
Thu Aug 13 13:06:08 CEST 2015

Inside of I define the function:

def subwords ():
global subwordsDL
subwordsDL = {'enjoy':['like', 'appreciate', 'love', 'savor'],
'hurt':['damage', 'suffering']}
print (subwordsDL)

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',
Traceback (most recent call last):
  File "test", line 4, in <module>
    print (subwordsDL)
NameError: name 'subwordsDL' is not defined

LOLŠworked on this for over an hourŠ

Please help.


Always, Dwight

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list