Skip to content

Commit

Permalink
Update Python_notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ceilbeck committed Aug 2, 2023
1 parent e464a8c commit b2b6f79
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Python_notes
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
The two subroutines, placed in a library file “minor1_lib.py”, are the key components of the Python code.

The line “import re” imports a library of Python routines called “re”.

The routine “pattern()” simply sets up the list of key words, separated by the “or” symbol “|” The characters “+ \” just break up the line so the text is more readable.
The routine “pattern()” simply sets up the list of key words, separated by the “or” symbol:“|” The characters “+ \” just break up the line so the text is more readable.

The routine “kw_list()” is the one that does all the work. It looks for the text “pattern” in the string “text”. For each key word found, it prints out the key word in square brackets, together with 50 characters (“ pad”) on either side. It also increments the counters “key_wds” and “key_wds_overall” to keep track of how many times each key word appears, both in the current document and in the overall multi-document run. The “op_f” variable is the address of the output file for results.

Expand Down

0 comments on commit b2b6f79

Please sign in to comment.