[Tutor] Newbie Trouble Processing SRT Strings In Text File
Danny Yoo
dyoo at hashcollision.org
Fri Oct 31 18:18:16 CET 2014
[code cut]
Hi Matt,
It looks like you're trying to write your own srt parser as part of this
problem. If you're in a hurry, you may want to look at existing parsers
that people have written. For example:
https://github.com/byroot/pysrt
But, even though it successfully kills these additional newlines that
> seem to form in the list-making process...I end up with basically a
> non-concatenated file of strings...with the right spaces I need, but
> not one big chunk of text, like I expect using the s.strip('\n')
> functionality.
>
Rather than immediately print the string, you may want to accumulate your
results in a list. You can then do some processing on your list of strings.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141031/de836b52/attachment-0001.html>
More information about the Tutor
mailing list