Search code examples
pythonalignmentjustify

Output Right Alignment


output.write('{:>10}'.format(line[39:49]))

This is still providing me with a left justified output. What am I doing wrong?


Solution

  • I take a random guess at what your problem might be. Does

    output.write('{:>10}'.format(line[39:49].strip()))
    #                                       ^^^^^^^^
    

    produce the desired output?