Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import locale
  2.  
  3.  
  4. def body():
  5. suggestion = 3500
  6. str_value = input(
  7. "Digite a pretenção salarial (exemplo: R${}): ".format(
  8. locale.format("%.2f", suggestion)
  9. )
  10. )
  11. value = locale.atof(str_value)
  12. print(
  13. "Valor numérico interno: {}. Valor formatado: {}".format(
  14. value,
  15. locale.format("%.2f", value, grouping=True, monetary=True)
  16. )
  17. )
  18.  
  19.  
  20. def main():
  21. for locale_name in ("pt_BR", "en_US"):
  22. locale.setlocale(locale.LC_ALL, (locale_name, ""))
  23. print("nnExemplo usando o locale {}: n".format(locale_name))
  24. body()
  25.  
  26.  
  27. if __name__ == "__main__":
  28. main()
  29.  
  30. numero = input('Entre com o numero : ')
  31. novoNumero = numero.replace(".",",")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement