python list to newline separated value

后端 未结 5 2085
孤独总比滥情好
孤独总比滥情好 2020-12-11 11:54


Im trying to get data in pylon to use in jquery autocomplete, the librarary i\'m using for autocomplete it requires this format

abc
pqr
xyz
         


        
5条回答
  •  有刺的猬
    2020-12-11 12:29

    I think you want this, though it's hard to know based on your description:

      >>> l = [["abc"],["pqr"],["xyz"]]
      >>> "".join(map(lambda a:a[0] + "\n",l))
      'abc\npqr\nxyz\n'
    

提交回复
热议问题