Exercise: Replace Python


Write a script called replace_python.py that given a file will replace all occurrences of "Python" or "python" by Java, but will avoid replacing the word in Monty Python. It prints the resulting rows to the screen.

For example given the input:


examples/regex/text_with_python.txt
Just a line without either of the languages.
Line with both Python and python
A line with Monty Python.
And a  line with Monty Python and Python.

Will print:


examples/regex/text_with_java.txt
Just a line without either of the languages.
Line with both Java and java
A line with Monty Python.
And a  line with Monty Python and Java.