python How to read a list of words from a file then run the

python

How to read a list of words from a file then run the md5 hash algorithm on all words in the file

Solution

import hashlib
import nltk
from nltk.tokenize import PunktSentenceTokenizer
from nltk.tokenize import word_tokenize

myfile = open(\"D:/input.txt\",\"r\");
sent_tokenizer = PunktSentenceTokenizer()
mylist = myfile.read();
for sent in sent_tokenizer.tokenize(mylist):
for word in word_tokenize(sent):
hash_object = hashlib.md5(mylist.encode())
print(hash_object.hexdigest())

python How to read a list of words from a file then run the md5 hash algorithm on all words in the fileSolutionimport hashlib import nltk from nltk.tokenize imp

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site