Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

word2number python

# first run in terminal $ pip install word2number

from word2number import w2n

print w2n.word_to_num("two million three thousand nine hundred and eighty four")
# 2003984

print(w2n.word_to_num('two point three'))
# 2.3

print(w2n.word_to_num('112'))
# 112

print(w2n.word_to_num('point one'))
# 0.1

print(w2n.word_to_num('one hundred thirty-five'))
# 135

print(w2n.word_to_num('million million'))
# Error: Redundant number! Please enter a valid number word (eg. two million twenty three thousand and forty nine)
# None

print(w2n.word_to_num('blah'))
# Error: No valid number words found! Please enter a valid number word (eg. two million twenty three thousand and forty nine)
# None
Comment

PREVIOUS NEXT
Code Example
Python :: separating tuple in pandas 
Python :: python while false loop 
Python :: NumPy unique Example Get the unique rows and columns 
Python :: pythone csv 
Python :: iterate over classes in module python 
Python :: python subtract every element in list 
Python :: tty escape 
Python :: how to install ffmpeg python heroku 
Python :: django environment variables 
Python :: How to remove all characters after a specific character in python? 
Python :: python 7zip extract 
Python :: how to convert each string to a category or int in python dataframe 
Python :: random python between 0 and 1 
Python :: python subtract list from list 
Python :: Exit code: ENOENT. spawn /usr/bin/python ENOENT 
Python :: python sort dict by value 
Python :: seed python 
Python :: how to find the speed of a python program 
Python :: python virtual enviroment 
Python :: python trim whitespace from end of string 
Python :: do not show figure matplotlib 
Python :: django authenticate 
Python :: python distilled 
Python :: from collections import defaultdict 
Python :: python tqdm 
Python :: search in dict python 
Python :: how append a directory based on current directory python 
Python :: coding planets 
Python :: pandas drop duplicate keep last 
Python :: click a button using selenium python 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =