[CODE=python]
aDict = {}
aDict['a'] = 5
aDict['bc'] = 'st'
aDict['zip'] = 12345
def outputMethod(** aDict):
print aDict['a']
print aDict['bc']
print aDict['zip']
return
def outputMethod1(* *aDict):
for key in aDict:
...
...
print a
print bc
print zip
return
outputMethod(** aDict)
outputMethod1(* *aDict)
[/CODE]
with reference to the above code, I would like to define variables on the fly in outputMethod1 using the dictionary keys as variable names, so that i can print using just the variable names instead using the Dictionary keys as shown in ouputmethod. I am trying a for loop to extract the keys from the dictionary...bu t not sure how to define the "keys" as variable names?
Thanks in advance.
SKN
aDict = {}
aDict['a'] = 5
aDict['bc'] = 'st'
aDict['zip'] = 12345
def outputMethod(** aDict):
print aDict['a']
print aDict['bc']
print aDict['zip']
return
def outputMethod1(* *aDict):
for key in aDict:
...
...
print a
print bc
print zip
return
outputMethod(** aDict)
outputMethod1(* *aDict)
[/CODE]
with reference to the above code, I would like to define variables on the fly in outputMethod1 using the dictionary keys as variable names, so that i can print using just the variable names instead using the Dictionary keys as shown in ouputmethod. I am trying a for loop to extract the keys from the dictionary...bu t not sure how to define the "keys" as variable names?
Thanks in advance.
SKN
Comment