Function return a dictionary

Boris Mok borismok at iwow.com.sg
Mon Oct 1 03:41:37 EDT 2007


Hi all,

I'm doing a function which needs return an arrary -- or more specially a 
dictionary data type.
I have a sample like this

def AFC():
  v["a"] = 1
  return v

v = AFC()
print v["a"]

with error
NameError: global name 'v' is not defined

how do I go about it?

Thanks in advance.
Boris Mok



More information about the Python-list mailing list