On Sep 17, 8:40 pm, peter <bori...@gmail.com> wrote: > i want to ask you if somebody knows how can I determine, with a help > of xlrd, what kind of decimal separator (. or ,) does the user have.
It's nothing to do with xlrd. It reads files and gives you the numbers as Python floats. Note that a user of locale A (uses '.') can save an Excel file and send it to a user of locale B (uses ',') and the receiver will see ',' -- as you might expect, locale-specific info is not kept in the file. If you want to find out the current user's decimal separator (and other useful info), use the locale module. Here's what I get after I change my regional settings on Windows XP to French/France: Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'French_France.1252' >>> locale.localeconv() {'mon_decimal_point': ',', 'int_frac_digits': 2, 'p_sep_by_space': 1, 'frac_digits': 2, 'thousands_sep': '\xa0', 'n_sign_posn': 1, 'decimal_point': ',', 'int_curr_symbol': 'EUR', 'n_cs_precedes': 0, 'p_sign_posn': 1, 'mon_thousands_sep': '\xa0', 'negative_sign': '-', 'currency_symbol': '\x80', 'n_sep_by_space': 1, 'mon_grouping': [3, 0], 'p_cs_precedes': 0, 'positive_sign': '', 'grouping': [3, 0]} Note: there are two different decimal separators. After switching it back to normal and re-starting Python: >>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'English_Australia.1252' >>> locale.localeconv() {'mon_decimal_point': '.', 'int_frac_digits': 2, 'p_sep_by_space': 0, 'frac_digits': 2, 'thousands_sep': ',', 'n_sign_posn': 3, 'decimal_point': '.', 'int_curr_symbol': 'AUD', 'n_cs_precedes': 1, 'p_sign_posn': 3, 'mon_thousands_sep': ',', 'negative_sign': '-', 'currency_symbol': '$', 'n_sep_by_space': 0, 'mon_grouping': [3, 0], 'p_cs_precedes': 1, 'positive_sign': '', 'grouping': [3, 0]} HTH, John -- http://mail.python.org/mailman/listinfo/python-list