d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Can Someone Write Me Acode For Some Fg?
Add Reply New Topic New Poll
Member
Posts: 14,925
Joined: Jan 3 2008
Gold: 135,879.75
Apr 20 2017 10:27am
Python

​Input.txt

1
00:00:28,980 --> 00:00:30,189
Des oiseaux ?

2
00:00:30,273 --> 00:00:34,778
Le grand Genghis Khan exige des oiseaux
en tribut, de notre ennemi ?

3
00:00:34,861 --> 00:00:37,279
Non, pas des oiseaux, jeune Kubilai.

4...

5...

6...

7... All the way up to as many as needed.

Output.txt

1: Des oiseaux ?

2: Le grand Genghis Khan exige des oiseaux en tribut, de notre ennemi ?

3: Non, pas des oiseaux, jeune Kubilai.

This post was edited by kdog3682 on Apr 20 2017 10:36am
Member
Posts: 3,197
Joined: May 4 2013
Gold: 1,457.00
Apr 20 2017 12:18pm
Code

import fileinput
import re
b=""
i=False
for line in fileinput.input("input.txt"):
if line.strip() == "":
print b
next
elif re.search("^([0-9]+)$", line.strip()):
b = line.strip() + ": "
next
elif re.search(" \-\-\> ", line.strip()):
next
else:
b = b + line.strip() + " "

Go Back To Programming & Development Topic List
Add Reply New Topic New Poll