AutomateTheBoringStuff.Ch08.Projects package

Submodules

AutomateTheBoringStuff.Ch08.Projects.P2_madlibs module

Mad libs

Create a Mad Libs program that reads in text files and lets the user add their own text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB appears in the text file.

For example, a text file may look like this:

The ADJECTIVE panda walked to the NOUN and then VERB. A nearby NOUN was
unaffected by these events.

The program would find these occurrences and prompt the user to replace them.

Enter an adjective:
silly
Enter a noun:
chandelier
Enter a verb:
screamed
Enter a noun:
pickup truck

The following text file would then be created:

The silly panda walked to the chandelier and then screamed. A nearby pickup
truck was unaffected by these events.

The results should be printed to the screen and saved to a new text file.

AutomateTheBoringStuff.Ch08.Projects.P2_madlibs.main()[source]

AutomateTheBoringStuff.Ch08.Projects.P3_regexSearch module

Regex search

Write a program that opens all .txt files in a folder and searches for any line that matches a user-supplied regular expression.

The results should be printed to the screen.

AutomateTheBoringStuff.Ch08.Projects.P3_regexSearch.main()[source]

Module contents