import sys starsavefile = open('e:\Starport\places.txt','r+') #file_name = input ('Enter Filename') #file_name = 'e:' +chr(92) +'Starport' + chr(92) + file_name #'e:\Starport\Starport.txt' #starsavefile = open(file_name,'r+') starsavefile.seek(0) #starsavelist =starsavefile.readlines() #starportlist = starportfile.readlines() #linelist = ([]) #savelist = ([]) #starrdict = {} def stripstring(stringtostrip): newword=('') tmpfile =('') for x in range (len(stringtostrip)): tmpfile = stringtostrip[x] if stringtostrip[x] == ' ': tmpfile =('') newword = (newword) + (tmpfile) return newword class starreport: def __init__(self): #self.L = ([]) pass def starline (self,starstring): # Strips Quouts and sepparate from commas into list newword=('') tmpfile =('') linelist = ([]) for x in range (len(starstring)): tmpfile = starstring[x] if starstring[x] == '"': tmpfile =('') if starstring[x] == ',': linelist.append(newword) newword=('') tmpfile =('') newword = (newword) + (tmpfile) self.L = linelist key = starreport() tom = starreport() filekey = starsavefile.readline() filelines = starsavefile.readline() tom.starline(filelines) key.starline(filekey) enterstate = raw_input('Enter State') entercity = raw_input('Enter City') newcity = ('') newstate = ('') #for x in range(50): while filelines<>'': newcity = stripstring(tom.L[0]) newstate = stripstring(tom.L[1]) #print newcity + ' ' + newstate; if entercity == newcity: if enterstate == newstate: tom.starline(filelines) print tom.L break filelines = starsavefile.readline() tom.starline(filelines) starsavefile.close() # savelist = starline(starsavelist[0]) #linelist = starline(starsavelist[1]) #for x in range (len(savelist)): # starrdict = {savelist(x):linelist(x)} #print starrdict