[Python] Metodo __str__(self):

Raffaele Salmaso raffaele a salmaso.org
Ven 20 Ott 2017 09:30:29 CEST


2017-10-20 8:52 GMT+02:00 Gabriele Battaglia <iz4apu at libero.it>:

> Al metodo __str__ di un oggetto, รจ possibile passare dei parametri?
>
No, ma potresti usare __format__()

https://docs.python.org/3/library/stdtypes.html#str.format
https://docs.python.org/3/library/string.html#formatspec
https://pyformat.info/#custom_1
https://gist.github.com/drmalex07/d80643716263bb18f346

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.python.it/pipermail/python/attachments/20171020/960b8818/attachment.html>


Maggiori informazioni sulla lista Python