I have table called EMP that has a column deptno with the values 10,20,30,40.
so requirement is first create list/diction which deptno number we need data for?
say we need data only for Deptno 10 & 20 and  each of these deptno should go into their own respective flat files say empdep10.csv and empdept20.csv
I was hoping to get some help
You can use the format function to make queries more dynamic. For example:
"""
SELECT *
FROM sdfkjshdf
WHERE sdkfags LIKE '%{}%'
""".format(my_variable)
Then use the same function when exporting the result set to a file so you can call the file something based on the parameters of the where function.
based on Oracle Query where clause create dynamic flat files using Python