Created
March 6, 2014 23:09
-
-
Save uttamg911/9401724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#The file python.txt contains the raw html lines that contain the word 'Python' ( scrapped from rwet.decontextualize.com ) | |
#imports the regular expression libraries | |
import re | |
file = open("python.txt","r"); #opens the text file in read mode | |
f = file.read(); #reads the text file into a string | |
t = re.sub('<[^<]+?>', '', f).replace("Python","Monty Python"); #strips the html code and replaces the word "Python" with "Monty Python" | |
t = t.replace('e','ing'); #this code replaces all occurrences of "e" with "ing" #Adds more fun when impersonated as a non-native english speaker | |
print t #prints the lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment