[Tutor] Pythonic way

Mark Lawrence breamoreboy at gmail.com
Tue Nov 20 15:45:11 EST 2018


On 20/11/2018 18:08, Avi Gross wrote:

> 
> We have two completely separate ways to format strings that end up with fairly similar functionality. Actually, there is an implicit third way 😊
> 

You could argue five ways :-)

1. C printf style formatting 
https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting
2. New style string formatting 
https://docs.python.org/3/library/string.html#string-formatting
3. f-strings 
https://docs.python.org/3/reference/lexical_analysis.html#f-strings
4. String templates 
https://docs.python.org/3/library/string.html#template-strings
5. String methods 
https://docs.python.org/3/library/stdtypes.html#string-methods

Any advance on five anybody?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list