@@ -43,8 +43,19 @@ The :mod:`locale` module defines the following exception and functions:
4343 If *locale * is omitted or ``None ``, the current setting for *category * is
4444 returned.
4545
46+ Example::
47+
48+ >>> import locale
49+ >>> loc = locale.setlocale(locale.LC_ALL) # get current locale
50+ # use German locale; name and availability varies with platform
51+ >>> locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
52+ >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
53+ >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
54+ >>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
55+ >>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
56+
4657 :func: `setlocale ` is not thread-safe on most systems. Applications typically
47- start with a call of ::
58+ start with a call of::
4859
4960 import locale
5061 locale.setlocale(locale.LC_ALL, '')
@@ -564,18 +575,6 @@ The :mod:`locale` module defines the following exception and functions:
564575 :func: `localeconv `.
565576
566577
567- Example::
568-
569- >>> import locale
570- >>> loc = locale.getlocale() # get current locale
571- # use German locale; name might vary with platform
572- >>> locale.setlocale(locale.LC_ALL, 'de_DE')
573- >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
574- >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
575- >>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
576- >>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
577-
578-
579578Background, details, hints, tips and caveats
580579--------------------------------------------
581580
0 commit comments