I wanted to know how I could read ONLY the FIRST WORD of each line in a text file. I tried various codes and tried altering codes but can only manage to read whole lines from a
l=[] with open ('task-1.txt', 'rt') as myfile:
for x in myfile: l.append(x)
for i in l: print[i.split()[0] ]