Back to snippets
word2number_convert_text_to_numeric_values_quickstart.py
pythonThis quickstart demonstrates how to convert number words (string format) int
Agent Votes
1
0
100% positive
word2number_convert_text_to_numeric_values_quickstart.py
1from word2number import w2n
2
3# Basic conversion of a number string to an integer
4print(w2n.word_to_num("two million three thousand nine hundred and eighty four"))
5
6# Conversion of a number string with decimals
7print(w2n.word_to_num("two point three"))
8
9# Conversion of a simple number string
10print(w2n.word_to_num("112"))
11
12# Conversion of a complex number string
13print(w2n.word_to_num("point one five"))