I am trying to supply the precision formating at run time: s = 123 print '(0x%-6X -)'%s where I try to dynamically supply the number 6 from (6- length of s), I can't find a way to dynamically supply that. Anyone hav any idea? Thanks