How to convert list into string with quotes in python

前端 未结 5 496
孤城傲影
孤城傲影 2020-12-11 21:12

i have a list and want it as a string with quotes mylist = [1,2,3]

require O/P as myString = \"\'1\',\'2\',\'3\'\"

i tried my

5条回答
  •  感情败类
    2020-12-11 21:41

    you can do this as well

    mylist = [1, 2, 3]
    mystring = str(map(str, mylist)).strip("[]")
    

提交回复
热议问题