I have files in a directory named somewhat like this:
V001_233.sql
V001_234.sql
V002_233.sql
V001_235.sql
...
...
I want to execute sql commands in the V001 files one by one. I am using the following code to identify the files with the V001 prefix:
import os
prefixed = [filename for filename in os.listdir('.') if filename.startswith("V001")]
but not sure how to read from the files itself as the above method only returns the file name as a list. Will appreciate any help.