Python Lowercase to uppercase amount

Source: Internet
Author: User

Python Lowercase to uppercase amount

Excerpt from: http://shine-it.net/index.php?topic=14575.0

def_rmb_upper (self, value):"""RMB capitalization from: http://topic.csdn.net/u/20091129/20/b778a93d-9f8f-4829-9297-d05b08a23f80.html The value of the incoming floating-point type is returned Back to Unicode string"""Map= [u"0", u" One", u"Ii.", u"three", u"Restaurant", u"Wu", u"Lu", u"Qi", u"BA", u"JIU"] Unit= [u"points", u"Angle", u"Yuan", u"Pick", u"Hundred", u"thousand", u"million", u"Pick", u"Hundred", u"thousand", u"billion", U"Pick", u"Hundred", u"thousand", u"million", u"Pick", u"Hundred", u"thousand", u"trillion"] Nums= []#take out each digit, integer convert the error of avoiding large number by character mode         forIinchRange (Len (unit)-3,-3, 1):            ifValue >= 10**iorI < 1: nums.append (int (round (value/(10**i), 2))%10) Words=[] Zflag= 0#Mark 0 consecutive times to delete the word, or insert 0 words in a timely mannerstart = Len (nums)-3 forIinchRange (Start,-3,-1):#make I correspond to the actual number of digits, negative numbers are the angular points            if0! = Nums[start-i]orLen (words) = =0:ifzflag:words.append (map[0]) Zflag=0 words.append (Map[nums[start-i]]) words.append (unit[i+2])            elif0 = = Ior(0 = = i%4 andZflag < 3):#control ' million/Yuan 'Words.append (unit[i+2]) Zflag=0Else: Zflag+ = 1ifWORDS[-1]! = Unit[0]:#End non-' sub ' complement wordWords.append (U"Whole")        return "'. Join (words)

Python Lowercase to uppercase amount

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.