视频时间戳重排python实现

来源:互联网 发布:淘宝找同款货源插件 编辑:程序博客网 时间:2024/05/22 14:33

这里只截取20条


原始 压缩后 重排后

26000793800000 26000833800000 26000873800000 26000913800000 26000953800000 26000993800000 26001033800000 26001073800000 26001113800000 26001153800000 26001193800000 26001233800000 26001273800000 26001313800000 26001353800000 26001393800000 26001753800000 26001793800000 26001833800000 2600187380000026000793800000 IDR 26000833800000 P 26000913800000 P 26000873800000 B 26001033800000 P 26000953800000 B 26000993800000 B 26001153800000 P 26001073800000 B 26001113800000 B 26001233800000 P 26001193800000 B 26001273800000 P 26001313800000 P 26001353800000 P 26001393800000 P 26001753800000 P 26001793800000 P 26001913800000 P 26001833800000 B26000793800000 IDR 26000833800000 P 26000873800000 B 26000913800000 P 26000953800000 B 26000993800000 B 26001033800000 P 26001073800000 B 26001113800000 B 26001153800000 P 26001193800000 B 26001233800000 P 26001273800000 P 26001313800000 P 26001353800000 P 26001393800000 P 26001753800000 P 26001793800000 P 26001833800000 B 26001873800000 B

python代码


#!/usr/bin/pythonimport sysdef get_line_type(line):    words = line.split();    return words[1];if __name__ == "__main__":    if(len(sys.argv) < 2):        print sys.argv[0] + ":too few arguments."        exit(0);    fp = open(sys.argv[1]);    line0 = "";    line1 = fp.readline().strip();        while line1:        t = get_line_type(line1);        if t == "B":            linet = line0;            line0 = line1;            line1 = linet;        if line0 != "":            print line0;                line0 = line1;        line1 = fp.readline().strip();    fp.close();


原创粉丝点击