Printing list/tuple elements on separate lines
Johnny Chang
johnnyz86 at gmail.com
Thu Jun 4 20:37:42 EDT 2009
I have a large list of strings that I am unpacking and splitting, and
I want each one to be on a new line. Someone showed me how to do it
and I got it working, except it is not printing each on its own
separate line as his did, making it incredibly hard to read. He did
it without adding a new line for anything. I can't get in touch with
him right now.
An example:
recs =
'asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf'
[(rec.split('f')) for rec in recs]
output:
[['asd', 'asd', 'asd', 'asd', 'asd', ''], ['asd', 'asd', 'asd', 'asd',
'asd', ''], ['asd', 'asd', 'asd', 'asd', 'asd', '']]
desired output:
[['asd', 'asd', 'asd', 'asd', 'asd', '']
['asd', 'asd', 'asd', 'asd', 'asd', '']
['asd', 'asd', 'asd', 'asd', 'asd', '']]
More information about the Python-list
mailing list