how to detect list separator in users machine with Python?
CSV file needs to be created on users machine and the list separator must be detected automatically (so that excel can read the CSV file).
I've found out that Excel takes CSV elements separator from "Regional Options -> Numbers -> List separator". locale module in Python is used to detect cultural settings, but it (locale.localeconv) does not contain list separator. Opening CSV writer with dialect='excel' does not help. Any idea how to get the correct separator?
EDIT
The following code seems to work (but can't accept any upvotes as the solution is not mine)
import locale
langlocale = locale.getdefaultlocale()[0]
locale.setlocale(locale.LC_ALL, langlocale)
dp = locale.localeconv()['decimal_point']
delimiter = ','
if dp == ',':
delimiter = ';'