python - list comprehension of a nested for loop -


unable transform following nested loop list comprehension:

for row in rows:     elements = row.strip().split('\t')     element in elements:         print(element) 

input data tab delimited:

ola    olb    olc    old ole    olf    olg    olh oli    olj    olk    olk oll    olm    oln    ooo  

desired output:

ola olb     olc     old ole     olf     olg     olh oli     olj     olk     olk oll     olm     oln     ooo  

like this

with open('tabdelim.txt') rows:     lstcmp = [item row in rows item in row.strip().split('\t')]     print('\n'.join(lstcmp)) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -