I am trying to open the file using a path instead of file name I used glob.glob
option to go and search in the path for an input file. Now I got struck with opening that. Any help would be appreciated.
import glob
a = (glob.glob("*/file.txt"))
with open (a, 'r') as f:
Trying to read the file.txt and I am getting error in line3. Any help would be appreciated.
Error: TypeError: expacted str, bytes or os.PathLike object, not list
glob.glob()
returns a list. You need to loop through it, opening each file.