Sure enough. There is it, right there in the documentation. I did not
read far enough.
My bad.
Thanks!
-Ken
--
https://mail.python.org/mailman/listinfo/python-list
On 2017-11-02 21:30, Ken Kundert wrote:
I just encountered this:
'{:0s}'.format('hello')
Traceback (most recent call last):
File "", line 1, in
ValueError: '=' alignment not allowed in string format specifier
The exception goes away if I do not specify a width of the string:
'{:s}'.form
I just encountered this:
>>> '{:0s}'.format('hello')
Traceback (most recent call last):
File "", line 1, in
ValueError: '=' alignment not allowed in string format specifier
The exception goes away if I do not specify a width of the string:
>>> '{:s}'.format('hello')
'hello'
My reading of the
Robert Dailey wrote:
I notice that the '0x' portion is counted in the width, which was
specified as 8. This seems wrong to me. Is this by design? If so, why?
Yes, it's the total field width. This is consistent with
the other formats, in which it includes decimal points,
signs, etc.
If you don
On Aug 11, 3:28 pm, Robert Dailey wrote:
> Hello,
>
> According to the Python 3.1 documentation, I can have a format
> specification like so:
>
> print( 'This is a hex number: {:#08x}'.format( 4 ) )
>
> This will print:
>
> This is a hex number: 0x04
>
> I notice that the '0x' portion is count
Robert Dailey wrote:
Hello,
According to the Python 3.1 documentation, I can have a format
specification like so:
print( 'This is a hex number: {:#08x}'.format( 4 ) )
This will print:
This is a hex number: 0x04
I notice that the '0x' portion is counted in the width, which was
specified a
Hello,
According to the Python 3.1 documentation, I can have a format
specification like so:
print( 'This is a hex number: {:#08x}'.format( 4 ) )
This will print:
This is a hex number: 0x04
I notice that the '0x' portion is counted in the width, which was
specified as 8. This seems wrong t