There are so many issues here
I think they want to unpack
I think they want to unpack
DictionnaryNamesTables
in the function callKeyList2 = DictionnaryTest2(*DictionnaryNamesTables)Of course then they will hit scope issues because of using locals() -
MyDictionnary
is not defined inside the function scope.Output:Key list (explicitly) : ['Abcissa', 'Ordinate', 'Altitude']
Key list (name=variable) : ['Abcissa', 'Ordinate', 'Altitude']
Key list in a function : ['Abcissa', 'Ordinate', 'Altitude']
MyDictionnary
MyDictionnary2
Type args = <class 'tuple'>
length args = 2
args = ('MyDictionnary', 'MyDictionnary2')
length args (after list())= 2
NewVar = MyDictionnary
Error:Traceback (most recent call last):
File "***", line *, in <module>
KeyList2 = DictionnaryTest2(*DictionnaryNamesTables)
File "***", line **, in DictionnaryTest2
KeyListFunction2 = list(locals()[NewVar].keys())
KeyError: 'MyDictionnary'
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs