Feb-08-2018, 04:15 PM
I am creating a simple program that looks up the name of a job and prints out the full job name and number.
I want to be able to put in partial string and have the program print any job name that has that string.
ie. user enters "short"
program prints "Short North Phase 3 - 2016-0401"
"Short North Phase 2 - 2016-0405"
"Short North Public Outreach - 2016-0551"
I am stuck on the printing multiple lines that match the input string.
here is my current code:
I want to be able to put in partial string and have the program print any job name that has that string.
ie. user enters "short"
program prints "Short North Phase 3 - 2016-0401"
"Short North Phase 2 - 2016-0405"
"Short North Public Outreach - 2016-0551"
I am stuck on the printing multiple lines that match the input string.
here is my current code:
while True:
jobname=input("Please enter job name")
jobname=jobname.upper()
jobs = open("jobs.txt")
for line in jobs:
record = line.split('|')
if jobname in record[0]:
found = True
break
else:
found = False
continue
if found == False:
print("Job name not found")
else:
print(record[0], record[1])any help would be greatly appreciated.
