How do I pass integer items of a list to a function as string arguments in Python?

arguments, list, python, string

Solution

So... we use the `*` operator to use a sequence as multiple arguments for a function call; and we want to convert each argument to a string. The conversion is most obviously and simply done by just passing the value to the builtin `str`; we can then just `map` that conversion function onto the list. These are all elementary techniques and all we have to do is put them together:

myfunc(*map(str, a))

Problem

I have a Python list consisting of integers: ``` a = [1, 2, 3] ``` I want to pass the items of this list as arguments to a function, and they must be strings: ``` myfunc("1", "2", "3") ``` How can I do it?

Original source