0% found this document useful (0 votes)
43 views

How To Search A Student ID With User Input and Output With The Student Name and Student ID in Python 4570611745706160

The program prompts the user to input a student ID and then opens a text file containing student records, with each record containing an ID and name separated by a space. It then iterates through each record, splitting the ID and name into separate variables.

Uploaded by

Sayantan Majhi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

How To Search A Student ID With User Input and Output With The Student Name and Student ID in Python 4570611745706160

The program prompts the user to input a student ID and then opens a text file containing student records, with each record containing an ID and name separated by a space. It then iterates through each record, splitting the ID and name into separate variables.

Uploaded by

Sayantan Majhi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

searchStudent = input("Please enter a student ID: ")

with open('C:\\Users\\jaspe\\Desktop\\PADS Assignment\\Student.txt') as f:


studentFile = f.readlines()
for student in studentFile:
id, name = student.strip().split(" ", 1)

You might also like