Ever wanted to see if a string contains a string in Python? Thought it was going to be complicated like C? Think again! Python implements this feature in a very easy to read and easy to implement fashion. There are two ways of doing it, and some will like one way better than the other, […]
Articles Tagged: str.find
Searching within a string for another string is pretty easy in Python:
>>> str = 'Hello, world'
This is fine if we know exactly what we’re looking for, but what if we’re looking for something not so well-defined? For example, if we want to search for a year, then we know it’s going to be a 4-digit sequence, but […]