[issue33013] Underscore in str.format with x option

2018-03-06 Thread Cheryl Sabella
Cheryl Sabella added the comment: Thanks guys. I really thought I tried '{0:_x}'.format(123456789), but I guess I hadn't. Good to know that using format(123456879, '_x) is better. -- ___ Python tracker ___

[issue33013] Underscore in str.format with x option

2018-03-06 Thread Eric V. Smith
Eric V. Smith added the comment: The format specifier (here, 'x') always goes last. >>> '{0:_x}'.format(123456789) '75b_cd15' See https://docs.python.org/3/library/string.html#formatstrings for the details. Serhiy is correct that it's often easier to use format() instead of ''.format() for t

[issue33013] Underscore in str.format with x option

2018-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >>> format(123456789, '_x') '75b_cd15' -- nosy: +serhiy.storchaka resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker __

[issue33013] Underscore in str.format with x option

2018-03-06 Thread Cheryl Sabella
New submission from Cheryl Sabella : >From the doc >(https://docs.python.org/3/library/string.html#format-specification-mini-language): > The '_' option signals the use of an underscore for a thousands separator for > floating point presentation types and for integer presentation type 'd'. For