Hi everyone, I have a function which accepts an alpha2 country code and a price string, where the aim is to get the country's currency and use the currency.letter property of that currency to format the supplied price string.
The above works fine so far - yet it falls over when called with Germany as the country as follows: currency = pycountry.currencies.get(numeric=country.numeric) The function implementation is as follows: def formatPrice(self, alpha2CountryCode, price): """ @param alpha2CountryCode: The 2-character country code for which to format the price value @param price: The price value as a string @return: A string representing the formatted monetary value for this country for this price. #Get country by alpha2 code country = pc.countries.get(alpha2=alpha2CountryCode.upper()) #Get currency by country's numeric and format price currency = pc.currencies.get(numeric=country.numeric) letter = currency.letter formattedCurrency = "%s %s" % (letter, price) return formattedCurrency Any ideas as to what the issue may be? Thanks :) -- Regards, Sithu Lloyd Dube
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor