Using NumPy:
import numpy as np
import numpy.lib.recfunctions as rfn
dtype = [('index', int), ('text', object)]
table = np.loadtxt(path_to_file, dtype=dtype, usecols=(0,2), delimiter='\t')
dtype = [('index', int), ('score', float)]
array = np.array(vec, dtype=dtype)
joined = rfn.join_by('index', table, array)
for row in joined:
print row['index'], row['score'], row['text']
If you care a lot about performance you can use np.savetxt()
to do the output too, but I thought it was easier to understand this way.