[issue18738] String formatting (% and str.format) issues with Enum

Eric V. Smith report at bugs.python.org
Fri Aug 16 02:26:54 CEST 2013


Eric V. Smith added the comment:

On 8/15/2013 8:20 PM, Ethan Furman wrote:
> The characters I list are the justification chars and the digits that would be used to specify the field width.  If 
> those are the only characters given then treat the MixedEnum member as the member string.

But a datetime format string can end in "0", for example.

>>> format(datetime.datetime.now(), '%H:%M:%S.00')
'20:25:27.00'

I think your code would produce the equivalent of:
>>> format(str(datetime.datetime.now()), '%H:%M:%S.00')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid conversion specification

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18738>
_______________________________________


More information about the Python-bugs-list mailing list