"how to convert list into string with quotes in python" Code Answer


this seems to be the only solution so far that isn't a hack...

>>> mylist = [1,2,3]
>>> ','.join("'{0}'".format(x) for x in mylist)

this can also be written more compactly as:

>>> ','.join(map("'{0}'".format, mylist))
By Saqib Ali on August 8 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.