[Tutor] Need help with code

Tyler Seacrist seacristt at hotmail.com
Mon Apr 17 22:12:33 EDT 2017


Hello,


How do I avoid this error message everytime I utilize wordlist = open("words.text") ?

>>> wordlist = open("words.txt")
Traceback (most recent call last):
  File "<pyshell#303>", line 1, in <module>
    wordlist = open("words.txt")
FileNotFoundError: [Errno 2] No such file or directory: 'words.txt'
>>> def calculate_abecedarian():
total_count = 0
for word in wordlist:
if is_abecedarian(word):
print (word)
total_count += 1
return total_count

or

>>> if __name__ == '__main__':
    fin = open('words.txt', 'r')
    print (no_contain(fin))


Traceback (most recent call last):
  File "<pyshell#213>", line 2, in <module>
    fin = open('words.txt', 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'words.txt'




More information about the Tutor mailing list