SyntaxFix
Write A Post
Hire A Developer
Questions
If you are trying to do this, it means you are doing something wrong. Consider using a dict instead.
dict
def show_val(vals, name): print "Name:", name, "val:", vals[name] vals = {'a': 1, 'b': 2} show_val(vals, 'b')
Output:
Name: b val: 2