Reputation: 19456
I've got an array of strings of the form ['this', 'that']
.
I need to get a string at the end that says:
('this', 'that')
I know I can get the comma in with .join(), how can I get the quotes around each item in the most elegant way?
Upvotes: 1
Views: 110
Reputation: 644
Like vaultah said use repr()
which is used to compute the string representation of an object.
For example,
if array = ['this', 'that', 'is', 'the', 'input']
then array = repr(tuple(array))
will result in: ('this', 'that', 'is', 'the', 'input')
Upvotes: 3