this is my code
with open('file.txt', 'r') as source:
# Indentation
polTerm = [line.strip().split()[0] for line in source.readlines()]
polFreq = [int(line.strip().split()[1]) for line in source.readlines()]
this is inside file.txt
anak 1
aset 3
atas 1
bangun 1
bank 9
benar 1
bentuk 1
I got the polTerm just like what I want:
['anak', 'aset', 'atas', 'bangun', 'bank', 'benar', 'bentuk']
but for the polFreq, instead of this:
['1', '3', '1', '1', '9', '1', '1']
what I got is blank list like this:
[ ]
anyone know why this happened? and how to fix this so I can get just like I what I want.