You can also do this in Python , as in this example:
with open("address_file", 'r') as f1, open("data_file", "r") as f2: data1 = f1.read().splitlines() data2 = f2.read().splitlines() for k in data1:
Edit: As suggested by @heemayl, here is another solution using only one list :
with open("file1", 'r') as f1, open("file2", 'r') as f2: data = f2.read().splitlines() for k in f1.read().splitlines(): print(data[int(k)-1])
Both output:
2.000589214 4.479511994 6.784499874 7.021239396 1.000451451 3.117892278 5.484514874
source share