-
-
Save altendky/208785bf1e6d2833c6ae49444cd4f51a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list1 = ['1\n', '00:04:11,588 --> 00:04:13,920\n', 'Nurse Evelyn! Nurse Evelyn!\n', '\n', '2\n', '00:04:15,024 --> 00:04:17,788\n', 'I have a message for you. In English!\n', '\n', '3\n', '00:04:35,345 --> 00:04:37,575\n'] | |
def get_strings_position_in_list(astring, alist, position): | |
for position, string in enumerate(alist): | |
if alist[position].find(astring) != -1: | |
yield position | |
for g in get_strings_position_in_list(" --> ", list1, 0): | |
print(g) | |
### next(g) output 1, and then next(g) it still be 1, It should be 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment