Kwpolska wrote:
> > out = 'Temperatures: {0:", ":.1f} Celsius'.format(temps)
>
> [...] your format is cryptic.
Thank you for your criticism, I'll think it over. The reason I find it readable
(-enough) is because even without knowing what format language is supported by
the temps object, you can
On Sat, Nov 10, 2012 at 5:51 PM, Paul Rubin wrote:
> […] Python's format strings are pretty much the same as C's format strings […]
You’re thinking about the old % syntax, 'Hello %s!' % 'world'. The OP
meant the new str.format syntax ('Hello {}!'.format('world')).
---
IMO, the idea is useless.
On Sat, 10 Nov 2012 02:26:28 -0800, Tobia Conforto wrote:
> Hello
>
> Lately I have been writing a lot of list join() operations variously
> including (and included in) string format() operations.
>
> For example:
>
> temps = [24.369, 24.550, 26.807, 27.531, 28.752]
>
> out = 'Temperatures
Tobia Conforto writes:
> Now, as much as I appreciate the heritage of Lisp, I won't deny than
> its format string mini-language is EVIL. ... Still, this is the
> grand^n-father of Python's format strings...
Without having yet read the rest of your post carefully, I wonder the
particular historica
Hello
Lately I have been writing a lot of list join() operations variously including
(and included in) string format() operations.
For example:
temps = [24.369, 24.550, 26.807, 27.531, 28.752]
out = 'Temperatures: {0} Celsius'.format(
', '.join('{0:.1f}'.format(t) for t in temp