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 ( to extract the address (cities) as return value.

Folder directory map:

├── 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

Need your ASSIGNMENT done? Use our paper writing service to score good grades and meet your deadlines.

Order a Similar Paper Order a Different Paper