You are viewing a single comment's thread from:

RE: Learn Python Series (#23) - Handling Regular Expressions Part 1

in #utopian-io6 years ago (edited)

Maybe you could use some regular expression knowledge for parsing pythen, or pythan and substitute it with python! Can you give me the code for that as a comment? I'll upvote your answer it you're correct! :-)

Sort:  

No dear I dont know about coding but my younger brother can do it because it is his field .

Ok then! Mind if I use your comment to give the answer myself in Part 2 then? :-)

import re

pattern = "pyth[ae]n"

replace = "Python"

string = """Wao great post dear about pythen 

your post give us a new lesson I like it dear beautifull 

we can learn alot of things about pythan"""

​

result = re.sub(pattern, replace, string)

print(result)

Wao great post dear about Python 
your post give us a new lesson I like it dear beautifull 
we can learn alot of things about Python

Hmm good I will try it .

Will you really???

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 67112.11
ETH 2610.99
USDT 1.00
SBD 2.67