1. Python / Говнокод #8047

    −84

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    def getListOf(points):
        i=1
        f=open('Welcome_sub.srt', 'a')
        for point in points:
                print "%d" % i
                f.write(str(i)+'\n')
                begin = point.getAttribute('begin').split(':')
                dur = point.getAttribute('dur').split(':')
                h=str( (int(begin[0])+int(dur[0])) if (int(begin[0])+int(dur[0]))>10 else '0'+str(int(begin[0])+int(dur[0])) )
                m=str(int(begin[1])+int(dur[1])) if (int(begin[1])+int(dur[1]))>10 else '0'+str(int(begin[1])+int(dur[1]))
                f.write(point.getAttribute('begin')+' --> '+''.join(h+':'+m+':'+str(float(begin[2])+float(dur[2])) )+'\n')
                print "%s -->%s" % (point.getAttribute('begin'), ''.join(h+':'+m+':'+str(float(begin[2])+float(dur[2])) ))
                f.write(getText(point.childNodes)+'\n')
                print "%s" % getText(point.childNodes)
                i+=1

    Запостил: nyators, 30 Сентября 2011

    Комментарии (3) RSS

    Добавить комментарий