I think I found 2 undocumented string format codes.

Alexander Kapps alex.kapps at web.de
Wed Aug 24 17:32:56 EDT 2011


On 24.08.2011 22:45, Bill wrote:
> My google-fu has failed me in finding info on %h and %l string
> formatting codes.
>
>>>> '%h' %'hello'
> exceptions.ValueError: incomplete format
>
>>>> '%l' %'hello'
> exceptions.ValueError: incomplete format
>
> Does anyone know what doing a "complete format" means?

See

http://docs.python.org/library/stdtypes.html#string-formatting-operations

The formatting codes have been borrowed from the C function 
sprintf(), where l and h are length modifier for integers (%hi, %li, 
...)

The Python docs (link above) say:

"A length modifier (h, l, or L) may be present, but is ignored as it 
is not necessary for Python – so e.g. %ld is identical to %d."




More information about the Python-list mailing list