Say this is my string: http://www.test.com/1/page/
And this is my sub_string: www.test.com/2/page/
Now if I run
sub_string in string
The result will obviously be False because 2 is not in the string. However, I don't care about that part. The only parts I care about are www.test.com and page. I want only these parts to be checked, and don't care about what's in between them. How can I perform a search in that way, so the results would be True?
.split()orpartition()and then use.startswith()and.endswith()to check for a match.