I am looking for a program that will search a file for all names from a state(NY,PA,etc) and by their county number (1,2,3.etc). this needs to be user inputted also def main(): legislatorsTxtFile= open("legislators-all.txt","r") stateName= input("enter a state abv.") districtNum= input("enter district Number") R1= legislatorsTxtFile.readline() # while loop #
R2= R1.split(",") if stateName in legislatorsTxtFile: print(stateName) print(legislatorsTxtFile)
this is all i have so far im a bit lost atm.