Test a string for a substring

StackOverflow

Is there an easy way to test a Python string "xxxxABCDyyyy" to see if "ABCD" is contained within it?

Answer rating: 217

if "ABCD" in "xxxxABCDyyyy":
    # whatever




Get Solution for free from DataCamp guru