[pyar] [Programación]Formatting numbers

Diva Satanica apokalyptica79 en gmail.com
Mar Mar 13 10:40:04 ART 2012


A ver le hago un copy paste con todas las opciones que vayan apareciendo.

Gracias

2012/3/13 Hernan Grecco <hernan.grecco en gmail.com>

> Yo soy un poco fanatico del PEP3101. Que tal esto:
>
>
> >>> monthly_pay = 5000.0
> >>> annual_pay = monthly_pay * 12
> >>> print('Your annual pay:\n{:,.2f}'.format(annual_pay))
> Your annual pay:
> 60,000.00
>
> Hernan
>
>
>
> On Tue, Mar 13, 2012 at 2:17 PM, Diva Satanica <apokalyptica79 en gmail.com>wrote:
>
>> Se acuerdan del ejemplo que dí:
>>
>> #This program demonstrates how a floating-point number can be displayed
>> as currency.
>> monthly_pay = 5000.0
>> annual_pay = monthly_pay * 12
>> print ('Your annual pay is $', \
>>          format(annual_pay, ',.2f'), \
>>          sep='')
>>
>> Bueno lo hice de otra manera:
>>
>> #This program demonstrates how a floating-point number can be displayed
>> as currency.
>> monthly_pay = 5000.0
>> annual_pay = monthly_pay * 12
>> print ('Your annual pay: ')
>> print (format(annual_pay, ',.2f'))
>>
>> Más que seguro que no está bien pero lo hice así y funcionó.
>>
>> Quedó así:
>>
>> Your annual pay:
>> 60,000.00
>>
>> Saludos
>>
>> PS: Espero puteadas [?][?]
>>  --
>>
>>
>> Divine queen of evil
>> Sowing her seeds of hate
>> Mistress of pain
>> Diva satanica - Master of temptation
>>
>> _______________________________________________
>> pyar mailing list pyar en python.org.ar
>> http://listas.python.org.ar/listinfo/pyar
>>
>> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>>
>> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
>> Argentina - http://www.usla.org.ar
>>
>
>
> _______________________________________________
> pyar mailing list pyar en python.org.ar
> http://listas.python.org.ar/listinfo/pyar
>
> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>
> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
> Argentina - http://www.usla.org.ar
>



-- 


Divine queen of evil
Sowing her seeds of hate
Mistress of pain
Diva satanica - Master of temptation
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20120313/c5c697ad/attachment.html>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: 331.gif
Type: image/gif
Size: 362 bytes
Desc: no disponible
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20120313/c5c697ad/attachment.gif>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: 32F.gif
Type: image/gif
Size: 104 bytes
Desc: no disponible
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20120313/c5c697ad/attachment-0001.gif>


More information about the pyar mailing list