Reputation: 4575
I have a list
['a','b','c']
I would like
'a','b','c'
I've tried
"','".join(tst)
but it returns a string
"a','b','c"
I need it in the format
'a','b','c'
for input to a function, can anyone suggest how to do this?
Upvotes: 0
Views: 53
Reputation: 15364
This is very simple, you just need to unpack the list with the star *
operator:
def f(a, b, c):
print(a)
print(b)
print(c)
f(*['a', 'b', 'c'])
This will correctly prints
a
b
c
Upvotes: 0
Reputation: 3245
Add the single quote at the beginning and at the end:
"'"+"','".join(tst)+"'"
Upvotes: 2