[Parsed_cropdetect_0 @ 0x7f8ee9c22c60] x1:438 x2:841 y1:0 y2:718 w:400 h:704 x:440 y:8 pts:638638 t:10.643967 crop=400:704:440:8
[Parsed_cropdetect_0 @ 0x7f8ee9c22c60] x1:438 x2:841 y1:0 y2:718 w:400 h:704 x:440 y:8 pts:640640 t:10.677333 crop=400:704:440:8
[Parsed_cropdetect_0 @ 0x7f8ee9c22c60] x1:438 x2:841 y1:0 y2:718 w:400 h:704 x:440 y:8 pts:642642 t:10.710700 crop=400:704:440:8
[Parsed_cropdetect_0 @ 0x7f8ee9c22c60] x1:438 x2:841 y1:0 y2:718 w:400 h:704 x:440 y:8 pts:644644 t:10.744067 crop=400:704:440:8
[Parsed_cropdetect_0 @ 0x7f8ee9c22c60] x1:438 x2:841 y1:0 y2:718 w:400 h:704 x:440 y:8 pts:646646 t:10.777433 crop=400:704:440:8
[Parsed_cropdetect_0 @ 0x7f8ee9c22c60] x1:438 x2:841 y1:0 y2:718 w:400 h:704 x:440 y:8 pts:648648 t:10.810800 crop=400:704:440:8
[Parsed_cropdetect_0 @ 0x7f8ee9c22c60] x1:438 x2:841 y1:0 y2:718 w:400 h:704 x:440 y:8 pts:650650 t:10.844167 crop=400:704:440:8
frame= 326 fps=0.0 q=0.0 Lsize=N/A time=00:00:10.89 bitrate=N/A
video:31kB audio:1876kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
如何得到最後一個子字符串「crop = 400:704:440:8」字符串?我能想到的是使用rfind(「crop =」)獲得初始索引,但我不確定接下來會做什麼?獲取字符串中的最後一個子字符串?
我的解決辦法:
start = output.rfind("crop=")
end = output.find('\n', start, len(output))
print output[start:end]
如果你有指標,size.You可以這樣做'一個[指數:指數+大小]' – 2014-11-24 11:23:50
@AshwaniDausodia在最終產量將取決於我輸入更改數字。所以我不知道他們會有多大。 – Johnny 2014-11-24 11:25:39
數據似乎是'list'而不是'string'請清除你的問題? – 2014-11-24 11:27:54