[Tutor] Your dog Scope bit me!
Sheila King
sheila@thinkspot.net
Mon, 20 Aug 2001 20:27:29 -0700
On Mon, 20 Aug 2001 23:16:45 -0400 (EDT), <fleet@teachout.org> wrote
about [Tutor] Your dog Scope bit me!:
:def get_upc():
: """retrieves upc dictionary as upc"""
: import pickle
: f=open("upc.dict")
: upc=pickle.load(f)
: f.close()
: print "UPC Dictionary retrieved"
:
:I'm assuming I have a scope problem. Guess I don't understand all I
:should about scopes. How do I run this from an interactive session so
:that I'm able to use the dictionary?
How about adding a last line to your function:
return upc
And then call it in your main code like this:
dict = get_upc()
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/