Skip to main content

classe para converter valor monetario para texto por extenso... e percentual por extenso

Project description

Exemplos de utilizacao da bilioteca value-to-text

# linha1: update pip 
# linha2: install lib value_to_text via pip
python -m pip install --upgrade pip
pip install value-to-text
# Escreve por extenso valores monetarios ate 999 Bilhoes
# Escreve por extenso valores nao monetarios ate 999 Bilhoes
# Escreve por extenso percentual de taxas de juros
# Possui parametros para troca de moeda e ou separadores
# Python puro, nao exige demais dependencias de libs externas

import a biblioteca value_to_text

from value_to_text.write_value import Value_to_text
value_to_text = Value_to_text()

metodo num_to_text

Escreve por extenso valores monetarios ate 999 Bilhoes

text = value_to_text.num_to_text( 100025545465.45 )
print(text)
'''result...
cem bilhoes e vinte e cinco milhoes e quinhentos e quarenta e 
cinco mil e quatrocentos e sessenta e cinco reais e quarenta e cinco centavos
'''

text = value_to_text.num_to_text('9.534,85', moeda_unit='dolar', moeda_plural='dolares')
print(text)
'''result...
nove mil e quinhentos e trinta e quatro dolares e oitenta e cinco centavos
'''

text = value_to_text.num_to_text('9.534,85', monetario=False)
print(text)
'''result...
nove mil e quinhentos e trinta e quatro virgula oitenta e cinco
'''

metodo perc_to_text

Escreve por extenso percentual de taxas de juros

text = value_to_text.perc_to_text( 0.38 )
print(text)
'''result...
zero virgula trinta e oito por cento
'''

text = value_to_text.perc_to_text( 25.10, nome_separador='ponto')
print(text)
'''result...
vinte e cinco ponto dez por cento
'''

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

value-to-text-1.0.2.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file value-to-text-1.0.2.tar.gz.

File metadata

  • Download URL: value-to-text-1.0.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for value-to-text-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ccc30e63c4b87ef18bd64bed88b794dbf3e1c872d2d94efb5b454e5c238712f0
MD5 174e40fdcdcc6d8faa92b6c2018db205
BLAKE2b-256 1b5e1874dfb2b5b265d40cc4eea4677581ebd39148519a1fb94620ad747d4923

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page