2021年3月18日星期四

How can I make a python list of strings to be read as arguments of a python function? [remake]

As my original question was closed due to 'not being minimalistic', I will explain what I want to do by giving you an example that I have made up.

I have a function called 'persona()' and this function has argument called 'alpha', 'beta', 'gamma' that just gets bool as its value (true or false) like this:

face = persona(alpha=true, beta=false, gamma=false)  

and I have a list that looks like below because I had no other option to get it otherwise.

ar_list = ['alpha', 'beta', 'gamma']  

If I want to get element in ar_list as an argument name ('alpha' in list as arguement alpha in persona() for example) of function persona(), how can I achieve this?

https://stackoverflow.com/questions/66700976/how-can-i-make-a-python-list-of-strings-to-be-read-as-arguments-of-a-python-func March 19, 2021 at 08:22AM

没有评论:

发表评论