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
Post a Comment