Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, sys
- import re
- if len(sys.argv) < 2:
- print 'USAGE:', sys.argv[0], "<Dialogue file name>"
- exit()
- filename = sys.argv[1]
- infile = open(filename)
- data = infile.readlines()
- infile.close()
- outfile = open(filename, 'w')
- for line in data:
- m = re.match('([0-9a-fA-F]{8}: )(.*)', line)
- if not m:
- outfile.write(line)
- else:
- addr = m.group(1)
- line = m.group(2).strip('\n')
- outfile.write(addr)
- txt = line.split('@')
- first = True
- for x in txt:
- if not first:
- outfile.write('@') #I think this is the easiest way to put the @s back in
- first = False
- outfile.write(x)
- if len(x) % 2 == 1:
- outfile.write(' ') #If there's already a space, it will add a second. Presumably the space was put in for readability.
- outfile.write('\n')
- outfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement