I am trying to make this code so the user is asked what line to search, then they enter it, and then you display the line the user is wanting.
import os
f = open("input_file_lab_1.txt","r")
allData = f.read()#3
cleanedData = allData.split("\n")
name = input("enter line to search\n").strip()
n = 0
while n == 0:
for line in range(len(cleanedData)):
if name in cleanedData[line]:
print(name)
n = 1
else:
pass
f.close()
Not sure if there is any easier way. i also keep on getting the error
File "os1.py", line 7, in <module>
name = input("enter line to search\n").strip()#5
AttributeError: 'int' object has no attribute 'strip'