Answered step by step
Verified Expert Solution
Link Copied!

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?

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Explain the development of human resource management (HRM)

Answered: 1 week ago