max . wrote: > hello i am writing a simple password tester that uses a word list and > am running into some problems when i read the words from a text file > they are written to the screen with a backslash at the end and i cant > seem to find a way to get rid of them > > here is the script: > > __name__="dictionary password tester" > __author__="max baseman ([EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>)" > __version__="0.1" > __discription__="tests a password against a dictonary" > ############################################################# > > print > print > password=raw_input("password >") > passlist=open("/Users/max/passlist.rtf","r") # passlist is just a list > of 50,000 words This is almost definitely the problem. .rtf is 'rich text formatting' which, depending on which program wrote it (word pad / Microsoft Word / etc) contains various degrees of markup / formatting mixed in with the text. If you want straight text, don't try to process the rtf and remove the formatting. Just save your file as a .txt (or anything else - just so long as the program that's actually saving it knows to save it as straight ascii without any markup.) > guesses=0 > for line in passlist: > line=line.replace('\ ','') #heres what i was trying now > guesses=guesses+1 > line=line.lower() > print line > if line==password: > print > print > print"you password was",line,"and it took",guesses,"guesses" > break > > > > > > p.s i am about to look up how to type to python and not show the text > for the password bit but if anyone knows please explain > any help would be great thanks try this link: http://docs.python.org/lib/module-getpass.html
HTH, -Luke _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor