Im trying to loop through perspective view and return a dictionary of parameters. Whats the best way to do it?
Here is my pseudo code
parameterList = {}
for param in view.custom.items():
parameterList.insert({str(param [0]):param [1]})
Im trying to loop through perspective view and return a dictionary of parameters. Whats the best way to do it?
Here is my pseudo code
parameterList = {}
for param in view.custom.items():
parameterList.insert({str(param [0]):param [1]})
paramList = {key: self.custom[key] for key in self.custom}
As long as we’re golfing…
return {k: v for k, v in self.custom.items()}
Or, duh,
return dict(self.custom.items())
Tip: use the </>
code formatting button to preserve indentation and apply syntax highlighting.
You can edit your question to fix it.