Removing Square Brackets and Double quotes from list

前端 未结 3 1053
情深已故
情深已故 2021-01-20 09:14

I need to remove Square brackets and Double quotes from python list for further processing of data.

My code for the same is as follows:

ips = [\'1.2.         


        
3条回答
  •  长发绾君心
    2021-01-20 09:37

    You can use formatting the string by accessing the element of list.

    In [58]: s = ''
    
    In [59]: for i in ips:
        s = s + "model.data.like (%{}%),".format(i)
    
    In [72]: s[:-1]
    Out[72]: 'model.data.like (%1.2.3.5%),model.data.like (%1.2.3.4%)'
    

提交回复
热议问题