Question: Hi there, how do I write a python program to search a specific data in text file and print the whole line? The data to
Hi there, how do I write a python program to search a specific data in text file and print the whole line? The data to search is the "ID" from the text file, then display the whole line. I had also included my code.

def newCustomerApprovalRejectStatus(): print(" ***All New Customer's Registration View: ") newCustomerFile = open("New_Customer.txt","r") print(newCustomerFile.read()) newCustomerFile.close()
#Search specific data in line and display it. newCustomerFile = open("New_Customer.txt","r") userID = input("Please Enter A Customer ID: ") for line in newCustomerFile: if (line.startswith(userID)): print(line) else: print("Customer ID not found. Please try again.") newCustomerApprovalRejectStatus()
while(True): pressEnter = input(" Press Enter to Go Back to Check Loan Offering and Eligibility Menu") if(len(pressEnter) >= 0): adminMenu() break
New_Customer.txt - Notepad File Edit Format View Help NAME ADDRESS Esther Puchong john petaling EMAIL esther@email.com john@email.com CONTACT 0123456789 012-9876543 GENDER female male D.O.B. 19.01.1986 01/01/1980 LOANTYPE education car LOANPERIOD 4 5 INSTALMENT 500 500 ID esther john PASSWORD qwerty poiuy
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
