Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question regarding list and searching files in python. What my objective is, is I need to take in a list of names and with each
Question regarding list and searching files in python. What my objective is, is I need to take in a list of names and with each name search the file Im opening and find the salary that goes with that name and print it out and then move to the next name. In the file it will have a list of names in salaries in the form of (Name | Salary). So far in my code Im able to use the list and find the first name and salary on the list but Im unable to get it to move to the next name on the list. Any tips please?
def find_salaries ( substr, infile): mylist = substr with open(infile) as b: for line in b: for i in mylist: if i in line: print(line)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started