How Do I Turn My Results In A Variable And Then Call Data From A .accdb File?
So I have several Attachment.accdb files in my directory. I need help figuring out the correct python code to first call out to my directory and to list out all the .accdb files O
Solution 1:
Okay, so you basically need to extract and merge data from files with the same name. Here is the first step
import pathlib
my_directory = pathlib.Path("./path/to/my_dir")
paths = list(my_directory.glob("**/*.accdb"))
# If you only want the file names# file_names = [path.name for path in my_directory.glob("**/*.accdb")]
This will give you a list containing the path to all of your files. Now you need to process them, which will look like this:
results = {}
for path in paths:
with path.open() as file:
for line in file:
line = line.strip() # To remove the trailing line feed# Do stuff with your line to put it into your result
Since I have no idea what a .accdb
file is like I can't really help further. You should either clarify your question or look into it by yourself. What you need to figure out now is:
- which data structure do you want for you result?
- what's in a .accdb
and how to extract the data you need from it to put it in your data structure
Post a Comment for "How Do I Turn My Results In A Variable And Then Call Data From A .accdb File?"