function that can search through all files in two directories

Hello 🙂

I need some help writing a function that can extract the address cities from two directories. The input is an ‘ID’ (file name without the .txt). Function will search through the entire directory and find the file with matching name. Matching file will be opened and searched with regex (re.search) to extract the address (cities) as return value.

Folder directory map:

searchAddress_x000D_
├── group1_x000D_
│   ├── A01.txt_x000D_
│   ├── A02.txt_x000D_
│   _x000D_
└── group2_x000D_
    ├── B01.txt_x000D_
    └── B02.txt

ID_input = B01

searchAddress (ID_input):

“function first check to see if B01 is a valid file name in all folder. Proceed to the open the fileB01.txt if file name is valid and extract the address (city information)

address line format like this:

Address. new york| tokyo| LA | SF

extract all the city names and count how many names in the address row

return two values. Count of cities in the address

List of cities

1. new york

2. tokyo

3. LA

4. SF





 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.