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 -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -