I am using glob to retrieve the path of all files in a folder ("data"):
import glob
import geopandas
for file in glob.glob(r"/home/data/*.txt"):
sf = geopandas.read_file(file)
However, here, I am interested in knowing how to retrieve only selected files whose names are listed in a variable as a list. For instance, I want the path of only the following files: aaa.txt, bdf.txt, hgr.txt, in the "data" folder, which are listed in variable "imp".
imp = ['aaa.txt', 'bdf.txt', 'hgr.txt']
r"/home/data/aaa.txt",r"/home/data/bdf.txt"andr"/home/data/hgr.txt"? If yes, why you need theglobthen?aaa.txt? Is it like*aaa.txtor*aaa*.txt?