You can use Python's built-in string methods to identify letters between other strings. Here's an example:
main.py426 chars13 lines
In this example, we find the index of the first occurrence of "world" and "doing" in the string. Then, we extract the substring between those two indices to get the letters between "world" and "doing". Note that we have to add the length of "world" to the start index so that we don't include it in the result.
Alternatively, you could use regular expressions to achieve the same result. Here's an example:
main.py446 chars15 lines
In this example, we define a regular expression pattern that matches the letters between "world" and "doing". We then use re.search to find the first match of the pattern in the string, and extract the letters between "world" and "doing" from the match using the group(1) method.
gistlibby LogSnag