Question: 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?

Question regarding list and searching files in python. What my objective is,

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!