Add quotes to every list element

后端 未结 4 2004
自闭症患者
自闭症患者 2020-12-13 09:10

I\'m very new to python. I need a simple and clear script to add quotes to every list elements. Let me explain more. Here is the my code.

parameters = [\'a\'         


        
4条回答
  •  情深已故
    2020-12-13 09:35

    In general (ignoring SQL)

    In [3]: print(' '.join('"%s"' % x for x in ['a', 'b']))                                                                                                                                              
    "a" "b"
    

提交回复
热议问题