Python split() method not working properly

<p>I want to use split() method for separating rupees and paise. In paise part it is showing 6 paise for 60 paise, 7 for 70 and so on.But if the paise is 44 it will show correctly.Is it not considering zero if it is at the end? [rupees and paise are Indian currency]</p><pre><br /><code>from num2words import num2words<br /><br />pre=405068.60<br />text1 = ''<br />text2 = ''<br />result1 = ''<br />result2 = ''<br />entire_num = int((str(pre).split('.'))[0])<br />decimal_num = int((str(pre).split('.'))[1])<br />print "Decimal number=%d" %decimal_num<br />text1=num2words(entire_num, lang='en_IN').capitalize()<br />text2=num2words(decimal_num, lang='en_IN')<br />result1=text1+' '+'rupees'<br />if(decimal_num>0):<br /> result2 = ' and '+text2+' paise'<br />print result1+result2<br /></code><br /></pre><br /><h2>Click here view more answers <a href="http://ift.tt/1KG77Zd">http://ift.tt/1KG77Zd</a></h2>

Nhận xét

Bài đăng phổ biến từ blog này

Align div to bottom of the page in bootstrap

Align elements inside an tag vertically

Javascript is unable to stop page loading