I'm trying to right align some text, with a variable alignment.
For instance this works:
>>> print '{:>10}'.format('foo') foo
But this does not:
>>> x = 10 >>> print '{:>x}'.format('foo')
Check docs:
You are looking for:
>>> print '{0:>{x}}'.format('foo', x=x) foo