python: converting numbers to words

后端 未结 4 625
无人共我
无人共我 2021-01-13 23:08

I\'m trying to write a code that will convert numbers to words, up to 999 trillion. here is my code so far. it works up to 119, but after that things get messy. I can\'t use

4条回答
  •  时光取名叫无心
    2021-01-13 23:41

    I don't want to discourage you, but this problem has already been solved. There is a neat Python module to do this, called num2words

    Here is the link to the GitHub repository

    And here is the actual script for the English language (it supports multiple languages). There you can get some inspiration to fix your script if still needed.

提交回复
热议问题