In Python, it possible to cut out a section of text in a document when you only know the beginning and end words?
For example, using the bill of rights as the sample document, search for “Amendment 3” and remove all the text until you hit “Amendment 4” without actually knowing or caring what text exists between the two end points.
The reason I’m asking is I would like to use this Python script to modify my other Python programs when I upload them to the client’s computer — removing sections of code that exists between a comment that says “#chop-begin” and “#chop-end”. I do not want the client to have access to all of the functions without paying for the better version of the code.
You can use Python’s
remodule.I wrote this example script for removing the sections of code in file: