Join a list of strings in python and wrap each string in quotation marks

Update 2021: With f strings in Python3

>>> words = ['hello', 'world', 'you', 'look', 'nice']
>>> ', '.join(f'"{w}"' for w in words)
'"hello", "world", "you", "look", "nice"'

Original Answer (Supports Python 2.6+)

>>> words = ['hello', 'world', 'you', 'look', 'nice']
>>> ', '.join('"{0}"'.format(w) for w in words)
'"hello", "world", "you", "look", "nice"'

Leave a Comment