On 15/06/13 01:23, Dotan Cohen wrote:
What are these two string-formatting styles called?
'%.3f' % x
'{0:.3f}'.format(x)

"String formatting", and "string formatting" *wink*

Sometimes the first is called "string interpolation". Sometimes it is called 
"printf-style formatting", after the C function.


Where in the fine manual is their names shown? Thanks!

Like most things to do with strings, the place to start is the section on 
strings:

http://docs.python.org/3/library/stdtypes.html#text-sequence-type-str

which leads to:

http://docs.python.org/3/library/stdtypes.html#str.format

and

http://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting


For Python 2, start here instead:

http://docs.python.org/2/library/stdtypes.html



--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to