[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Formatting floating point

On 5/09/19 5:12 AM, Dave via Python-list wrote:

> My question is why, and where do I find a reliable source of information 
> on formatting numbers?? Not interested in replacement values like '{} 
> {}'.format(1, 2).

Agreed: there's ton(ne)s of information 'out there', much of it old, eg 
Python2, "formatter" (deprecated since v3.4), methods pre-dating 
f-strings, etc; and more of it rather casually thrown-out-there. 
Learning from StackOverflow (etc) has its limits/perils!

Authoritative Python docs: https://docs.python.org/3/
The "Mini-Language": 

Current advice (v3.6+) is to study the newer f-strings (formally 
"formatted string literals"): 
https://docs.python.org/3/tutorial/inputoutput.html which came from PEP 
498: https://www.python.org/dev/peps/pep-0498/

Regards =dn