Please evaluate your email program. Some of your newline s are
being lost in the paste into your email.
Matt Varner Wrote in message:
> TL:DR - Skip to "My Script: "subtrans.py"
>
>
>
> Optional Links to (perhaps) Helpful Images:
> 1. The SRT download button:
> http://i70.photobucket.com/alb
Matt Varner wrote:
> This result works perfectly (REMs removed):
>
> f = open('tmp.txt', 'r')
> o = open('result.txt', 'w')
> lns = f.readlines()
> f.close()
> for line in lns:
> if ".\n" in line:
> a = line.replace('.\n','. ')
> o.write(a)
> else:
> a = line.stri
Alan G wrote: "This is a bad idea. Instead, write your strings directly to o
o.write(s)
Print adds newlines automatically(unless you explicitly suppress
them). But printing to a file is messy compared to writing directly to
the file. (And also means you cant print debug messages while
developing
[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 additi
On 31/10/14 11:07, Matt Varner wrote:
# Import sys to get at stdout (standard output) - "print" results will
be written to file
import sys
This is a bad idea.
Instead, write your strings directly to o
o.write(s)
Print adds newlines automatically(unless you explicitly suppress them).
But prin
TL:DR - Skip to "My Script: "subtrans.py"
Optional Links to (perhaps) Helpful Images:
1. The SRT download button:
http://i70.photobucket.com/albums/i82/RavingNoah/Python%20Help/tutor1_zps080f20f7.png
2. A visual comparison of my current problem (see 'Desire Versus
Reality' below):
http://i70.ph