function that can search through all files in two directories
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
“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
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