Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

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





 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"