Can someone tell me what I am doing wrong here.
word_list = []
fd = open(“Julius Caesar.txt”)
fd.readlines()
for line in fd:
cleaned = line.strip()
split = line.split()
word_list = word_list + split
print(word_list[:1000])
fd.close()
Can someone tell me what I am doing wrong here.
word_list = []
fd = open(“Julius Caesar.txt”)
fd.readlines()
for line in fd:
cleaned = line.strip()
split = line.split()
word_list = word_list + split
print(word_list[:1000])
fd.close()
readlines
and for line in fd
both read the file. remove the readlines code. Then later you should have split = cleaned.split()
to give you the words