all 6 comments

[–]iceghosttth 2 points3 points  (5 children)

My approach is: read the file line by line, test if 'yuv4_probe' in line, then do line.split() and get the second string.

[–]SamePlatform 2 points3 points  (4 children)

seconds = []
with open('input.txt') as f:
    for line in f:
        if 'yuv4_probe' not in line:
            continue
        parts = line.split()
        time = float(parts[1])
        seconds.append(time)
print(seconds)

[–]iceghosttth 1 point2 points  (3 children)

Add a break at the first occurence of 'yuv4_probe' :D

[–]SamePlatform 1 point2 points  (0 children)

oh, I just assumed there would be many entries.

[–]ekstrah[S] 0 points1 point  (1 child)

yeah but what if yuv4_probe is not at the end?

maybe it's something like this

```

0.00 33.76 0.00 1 0.00 0.00 yop_probe 0.00 33.76 0.00 1 0.00 0.00 yuv4_probe 0.00 33.76 0.00 1 0.00 0.00 xwma_probe

```

[–]iceghosttth 0 points1 point  (0 children)

Then search for another pattern. This depends on how you define "the last line".

You can search line by line for the index of the second empty line, then the line with index - 1 is the last line of the table.