#encoding=utf-8
import sys
map = {1:"一",2:"二",3: "三",4: "四",5:"五",6:"六",7:"七",8:"八",9:"九",10:"十",100:"百",1000:"千",10000:"万"}
#number = 12345
number = int(sys.argv[1])
read =""
if number > 10000:
read += map.get(number/10000) + "万"
if number%10000 > 1000:
read += map.get(number%10000/1000) + "千"
if number/10000 and not(number/1000)%10:
read += "零"
if number%10000%1000 > 100:
read += map.get(number %10000%1000/100) + "百"
if number/1000 and not (number/100)%10:
read = read.strip("零") + "零"
if number%10000%1000%100 > 10:
read += map.get(number %10000%1000%100/10) + "十"
if number/100 and not (number/10)%10:
read = read.strip("零") + "零"
read += map.get(number%10000%1000%100%10)
read = read.strip()
print(read)
转载于:https://my.oschina.net/innovation/blog/806712