Spaces:
Running
Running
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import re | |
string = """ | |
2024/12/11 06:10:03 speech starts at 4.45s | |
2024/12/11 06:10:03 speech ends at 4.96s | |
2024/12/11 06:10:03 speech starts at 9.63s | |
2024/12/11 06:10:03 speech ends at 9.92s | |
2024/12/11 06:10:03 speech starts at 20.58s | |
2024/12/11 06:10:03 speech ends at 21.02s | |
2024/12/11 06:10:03 speech starts at 27.36s | |
2024/12/11 06:10:03 speech ends at 27.61s | |
2024/12/11 06:10:03 speech starts at 27.97s | |
2024/12/11 06:10:03 speech ends at 31.20s | |
2024/12/11 06:10:03 speech starts at 31.55s | |
2024/12/11 06:10:03 speech ends at 33.21s | |
""" | |
pattern = ".*?speech starts at (.+?)s[\r\n].*?speech ends at (.+?)s" | |
result = re.findall(pattern, string, flags=re.DOTALL) | |
print(result) | |
if __name__ == "__main__": | |
pass | |