Fix Python – Test a string for a substring [duplicate]


Asked By – Nate

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

Now we will see solution for issue: Test a string for a substring [duplicate]


if "ABCD" in "xxxxABCDyyyy":
    # whatever

This question is answered By – Sven Marnach

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0