I have text file in which each row with single word. convert it into line using python -


i have text file single word in each row.

i want convert line using python.

input: file.txt

word1 in row1 word2 in row2 word3 in row3 word4 in row4 

expected output: ['word1.z', 'word2.z', 'word3.z', 'word4.z']

['%s.z'%s s in open('myfile.txt').read().split()] 

or if myfile.txt big:

['%s.z'%s s in open('myfile.txt').readline().split()] 

Comments