-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currency value in words #132
Comments
You can do something like this using https://pypi.org/project/inflect/ import math
import inflect # pip install inflect
value = 78568.1257
p = inflect.engine()
cents, dollars = math.modf(value)
dollars = p.number_to_words(round(dollars))
cents = p.number_to_words(round(cents * 100))
print(f"{dollars} dollars and {cents} cents")
|
Thanks Python-Humanize/Humanize. Appreciate it.
Best Regards,
Md. Niaj Shahriar Shishir
Software Engineer and Server Specialist,
Metamorphosis Ltd,
Dhaka, Bangladesh.
Cell: 01827512928
…On Tue, Aug 1, 2023, 4:46 PM Hugo van Kemenade ***@***.***> wrote:
You can do something like this using https://pypi.org/project/inflect/
import math
import inflect # pip install inflect
value = 78568.1257p = inflect.engine()
cents, dollars = math.modf(value)
dollars = p.number_to_words(round(dollars))cents = p.number_to_words(round(cents * 100))
print(f"{dollars} dollars and {cents} cents")
seventy-eight thousand, five hundred and sixty-eight dollars and thirteen cents
—
Reply to this email directly, view it on GitHub
<#132 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARQHARHH37JFDLW7KQGJ5MTXTDM6VANCNFSM6AAAAAA2PWB4KQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What did you do?
Wanted to print the Sale order total say "78568.1257" in Human readable string.
What did you expect to happen?
output like "Seventy eight thousand five hundred sixty eight dollar and thirteen cents"
What actually happened?
78.57 thousand
What versions are you using?
4.7.0
The text was updated successfully, but these errors were encountered: