internationalization - Standardizing American or European Decimal values in Python -
a user can input 6.500,00 6,500.00 or 6500 or 6.500 or 6,500 mean decimal("6500")
in python, how can receive of values inputs , homecoming right value decimal?
some kind of forloop lot of replace.
b = ['6.500,00','6,500.00','6.500','6,500','6 500'] in b: if(',' in , '.' in a): if(a.index(',') > a.index('.')): print a.replace('.','').replace(',','.') else: print a.replace(',','') elif(',' in or ' ' in or '.' in a): print a.replace(',','').replace(' ','').replace('.','') else: print alltough never know if user wants input decimal.
python internationalization decimal
No comments:
Post a Comment