output.write('{:>10}'.format(line[39:49]))
This is still providing me with a left justified output. What am I doing wrong?
I take a random guess at what your problem might be. Does
output.write('{:>10}'.format(line[39:49].strip()))
# ^^^^^^^^
produce the desired output?