开发者

display each record of list into a separate line in jython

开发者 https://www.devze.com 2022-12-25 08:31 出处:网络
how to display record of the list in different line [\'0 , INDIVS08 , ODI_TEMP\', \'1 , C$_0EMPLOYEES , ODI_TEMP\', \'2 , C$_0PACS08 , ODI_TEMP\']

how to display record of the list in different line

['0 , INDIVS08 , ODI_TEMP', '1 , C$_0EMPLOYEES , ODI_TEMP', '2 , C$_0PACS08 , ODI_TEMP']

i want to display as

'0 , INDIVS08 , ODI_TEMP' ,
'1 , C$_开发者_如何学C0EMPLOYEES , ODI_TEMP',
'2 , C$_0PACS08 , ODI_TEMP'

Thanks for all of your help


lst = ['0 , INDIVS08 , ODI_TEMP', '1 , C$_0EMPLOYEES , ODI_TEMP', '2 , C$_0PACS08 , ODI_TEMP']
print(',\n'.join(["'%s'" % s for s in lst]))

',\n'.join() joins list, so it will be printed in separate lines with ending with comma.

["'%s'" % s for s in lst] is a little compilated, but it adds ' for every item in lst.

0

精彩评论

暂无评论...
验证码 换一张
取 消