tags:

views:

9

answers:

1

Hi everyone,

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$_0EMPLOYEES , ODI_TEMP',
'2 , C$_0PACS08 , ODI_TEMP'

Thanks for all of your help

A: 
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.

Michał Niklas