[issue43932] f-string decimal has leading space

2021-04-24 Thread Mark Dickinson


Change by Mark Dickinson :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43932] f-string decimal has leading space

2021-04-24 Thread Mark Dickinson


Mark Dickinson  added the comment:

This is by design, and documented under the "sign" section here: 
https://docs.python.org/3/library/string.html#format-specification-mini-language

The space before ".2f" is an instruction to leave space for a sign, "-" for a 
negative number and " " for a positive number. To avoid that space, use a 
format of ".2f" instead of " .2f".

>>> format(15, ".2f")
'15.00'
>>> format(15, " .2f")
' 15.00'
>>> format(15, "+.2f")
'+15.00'

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43932] f-string decimal has leading space

2021-04-24 Thread Akshay K


New submission from Akshay K :

When using a f-string to print a number with a certain number of decimal 
places, the number is printed with a leading space.

--
components: Interpreter Core
files: fstringdemo.py
messages: 391789
nosy: Axeinator, eric.smith
priority: normal
severity: normal
status: open
title: f-string decimal has leading space
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49981/fstringdemo.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com