Hello my friend;
1.here is how you can convert your amount_total to the available currency:
import urllib2
import json
def currencyConverter(currency_from,currency_to,currency_input):
yql_base_url = "https://query.yahooapis.com/v1/public/yql"
yql_query = 'select * from yahoo.finance.xchange where pair in ("'+currency_from+currency_to+'")'
yql_query_url = yql_base_url + "?q=" + yql_query + "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"
try:
yql_response = urllib2.urlopen(yql_query_url)
try:
yql_json = json.loads(yql_response.read())
currency_output = currency_input * float(yql_json['query']['results']['rate']['Rate'])
return currency_output
except (ValueError, KeyError, TypeError):
return "JSON format error"
except IOError, e:
if hasattr(e, 'code'):
return e.code
elif hasattr(e, 'reason'):
return e.reason
###### in the currency_input you will put your amount_total that you have got in euros###
currency_input = 1
currency_from = "EUR" # currency codes : http://en.wikipedia.org/wiki/ISO_4217
currency_to = "INR"
rate = currencyConverter(currency_from,currency_to,currency_input)
print rate
2.And then to have the amount_total in word you will use this:
Use pynum2word module that can be found at sourceforge
>>> import num2word
>>> num2word.to_card(15)
'fifteen'
>>> num2word.to_card(55)
'fifty-five'
>>> num2word.to_card(1555)
'one thousand, five hundred and fifty-five'
here is a useful link to this part:
http://stackoverflow.com/questions/8982163/how-do-i-tell-python-to-convert-integers-into-words
Best regards.