Skip to content

Instantly share code, notes, and snippets.

@uttamg911
Created March 6, 2014 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uttamg911/9401724 to your computer and use it in GitHub Desktop.
Save uttamg911/9401724 to your computer and use it in GitHub Desktop.
#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