@@ -48,8 +48,19 @@ The :mod:`locale` module defines the following exception and functions:
4848 If *locale * is omitted or ``None ``, the current setting for *category * is
4949 returned.
5050
51+ Example::
52+
53+ >>> import locale
54+ >>> loc = locale.setlocale(locale.LC_ALL) # get current locale
55+ # use German locale; name and availability varies with platform
56+ >>> locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
57+ >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
58+ >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
59+ >>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
60+ >>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
61+
5162 :func: `setlocale ` is not thread-safe on most systems. Applications typically
52- start with a call of ::
63+ start with a call of::
5364
5465 import locale
5566 locale.setlocale(locale.LC_ALL, '')
@@ -580,18 +591,6 @@ The :mod:`locale` module defines the following exception and functions:
580591 :func: `localeconv `.
581592
582593
583- Example::
584-
585- >>> import locale
586- >>> loc = locale.getlocale() # get current locale
587- # use German locale; name might vary with platform
588- >>> locale.setlocale(locale.LC_ALL, 'de_DE')
589- >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut
590- >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
591- >>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale
592- >>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
593-
594-
595594Background, details, hints, tips and caveats
596595--------------------------------------------
597596
0 commit comments