'Assign values from one list to another list

I have a folder dir_in containing set of files and supplied another list var with possibly variable names for the files.

dir_in = 'my_files/data/' contains

fileA.txt

fileB.txt

fileC.txt

var = ['A', 'B', 'C']

I wish to iteratively assign each variable in var to it's respective file in dir_in such that I get that file each time the variable is called. E.g. A = fileA.txt Any hints here please?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source