User:Cristinac/RegEx: Difference between revisions
(Created page with "<source lang="python"> import sys, re word = "yes" print ("this is the word:", word) while True: line = sys.stdin.readline() if line =='': break if line == word: pri...") |
(No difference)
|
Latest revision as of 21:37, 16 June 2015
import sys, re
word = "yes"
print ("this is the word:", word)
while True:
line = sys.stdin.readline()
if line =='':
break
if line == word:
print line
line = re.sub(r"\bI\b","_you", line, flags=re.I)
line = re.sub(r"\byou\b","_I", line, flags=re.I)
line = re.sub(r"_I","I", line, flags=re.I)
line = re.sub(r"_you","you", line, flags=re.I)
print line