On Fri, 21 Sep 2007 20:16:29 +0200, David <[EMAIL PROTECTED]> wrote:
>On 9/21/07, cyril giraudon <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> I 'd like to know if a std::setw() equivalent function exists in
>> python ?
>>
>> i thought of something like :
>>
>> a = 16
>> "%ai" % 12
>>
>> But it is not correct.
>>
>> Any Idea ?
>
>("%i" % 12).rjust(a)
>
>Or, more ugly:
>
>"%%%di" % a % 12
>
>The first % (after quotes) builds this string: "%16i".
>Then the second % operation converts that string to '              12'
>

Or '%*i' % (a, 12)

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to