I'm trying to get information from a data table .txt file from a list of objects in another .txt file.
in the code List.txt looks like
Obj2
Obj5
Obj6
etc.
and DataTable.txt looks something like
Obj1 Data1
Obj2 Data2
Obj3 Data3
etc.
I tried
f = file('List.txt')
g = file('DataTable.txt')
for line in f:
l = line.split()
name = l[0]
for row in g:
if row.startswith(name):
data = row.split()
print data[8]
but it only prints the data for the first entry on the list. Can anyone find the problem?