python regular expression to check if string contains substring -


i want create code return true if string contains word "post". when give code string "postgre", "postgres", "sqlpost" - return true. how can it?

you don't need regex this. use in operator:

>>> word = 'post' >>> word in 'postgres' true >>> word in 'sqlpost' true >>> word in 'fish' false 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

html - href attribute breaking an element -