What does this piece of code means in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does this piece of code means in python

pattern = r"(\.[\w\.]+)"

27th Jul 2018, 4:32 PM
adarsh pandey
adarsh pandey - avatar
2 Answers
+ 6
This is a regex pattern (regular expression). It will look for a dot \. followed by at least (+) one occurrence of either a letter or another dot [\w\.]. It's not really a python thing, regex can be used in many languages
27th Jul 2018, 5:06 PM
Anna
Anna - avatar
+ 1
thanks Anna
28th Jul 2018, 3:45 AM
adarsh pandey
adarsh pandey - avatar