我试着从一个txt文件中取出,并把它们放入一个变量中。我的代码是:#file_len function, got it from somewhere on stack exchange
def file_len(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass
return i + 1
#various variables, containing names/files
#wordList File, stores all the words
wordListFileName = '/Users/k/Desktop/Cyber/HashCrack/wordlist.txt'
wordListFile = open(wordListFileName)
#wordList list, stores all the words from the wordList file
wordList = []
#passList file, stores all the passwords
passListFileName = '/Users/k/Desktop/Cyber/HashCrack/passlist.txt'
passListFile = open(passListFileName, 'w')
#for loop, gets all the words in the wordList file, stores them in wordList list
for i in range(0, 185051):
if wordListFile.readline(i) == '':<