Is it possible to use *args to produce a list of dictionaries where each dictionary has the exact same key and each value is the arg?
For example, I currently have this function:
def Func(word1,word2):
return [{'This is a word':word1},{'This is a word':word2}]
And I use it like so:
print Func("Word1","Word2")
which returns:
[{'This is a word': 'Word1'}, {'This is a word': 'Word2'}]
The issue is that I want to use this Function with 1 word or 5 words. How could I use *args instead? Would starting a function like this be possible:
def Func(*args):
It would be amazing if I could produce the following as well where "This is a word" has the count like so:
[{'This is a word1': 'Word1'}, {'This is a word2': 'Word2'}]