Skip to content Skip to sidebar Skip to footer

Function Not Returning Value. Error "nameerror: Name 'urlss' Is Not Defined"

This is a part of my program. It gives the error NameError: name 'urlss' is not defined def testfunc(): urlss = 'hey' return urlss print urlss Why does this occur?

Solution 1:

urlss is a variable local to the scope of testfunc(); it cannot be accessed elsewhere. You might mean

print testfunc()

which in this case prints urlss, since that's what testfunc() returns.

Post a Comment for "Function Not Returning Value. Error "nameerror: Name 'urlss' Is Not Defined""