{ } Raw JSON

bundles / astropy latest / astropy / utils / misc / _set_locale

function

astropy.utils.misc:_set_locale

source: /astropy/utils/misc.py :505

Signature

def   _set_locale ( name )

Summary

Context manager to temporarily set the locale to name.

Extended Summary

An example is setting locale to "C" so that the C strtod() function will use "." as the decimal point to enable consistent numerical string parsing.

Note that one cannot nest multiple _set_locale() context manager statements as this causes a threading lock.

This code taken from https://stackoverflow.com/questions/18593661/how-do-i-strftime-a-date-object-in-a-different-locale.

Parameters

name : str

Locale name, e.g. "C" or "fr_FR".

Aliases

  • astropy.utils.misc._set_locale