mercredi 29 avril 2015

Problems With files

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)

main()

this is all i have so far im a bit lost atm.

Aucun commentaire:

Enregistrer un commentaire