Python string clean-up | SoloLearn: Learn to code for FREE!

+1

Python string clean-up

How would you start going about when you have a bunch of dirty OCR text files from archive.org and you want to throw out every word that is not included in a list of words in a dictionary? I want to do that in Python... Any help appreciated! ;)

5/16/2019 8:41:46 PM

::sk::

4 Answers

New Answer

+4

words = [word for word in list if word in dictionary] Steven I think those are both syntactically wrong 🤔

+1

Steven thank you for taking the time and answering in an abstract yet detailed way. I will see what I can do!

+1

Hehe thanks Anna

+1

Following up on my own question: I figured out a way that works for me without much hassle, comparing the text as a set using difference (): https://code.sololearn.com/cQ12Vw72r4ro/?ref=app