]> granicus.if.org Git - python/commitdiff
Fixed and extended the example; the original example contained some
authorGuido van Rossum <guido@python.org>
Sun, 22 Feb 1998 04:41:51 +0000 (04:41 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 22 Feb 1998 04:41:51 +0000 (04:41 +0000)
bogus code.

Doc/lib/liblocale.tex
Doc/liblocale.tex

index c4c5506569494735ed1940043290440f1da44e2e..6425797d437e2e8a0cdcd152bb14d0dd2c9e825e 100644 (file)
@@ -184,9 +184,12 @@ Example:
 
 \begin{verbatim}
 >>> import locale
->>> locale.open(locale.LC_ALL,"de") #setting locale to German
->>> locale.strcoll("f\344n","foo")  #comparing a string containing an umlaut 
->>> can.close()
+>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
+>>> locale.setlocale(locale.LC_ALL, "de") # use German locale
+>>> locale.strcoll("f\344n", "foo") # compare a string containing an umlaut 
+>>> locale.setlocale(locale.LC_ALL, "") # use user's preferred locale
+>>> locale.setlocale(locale.LC_ALL, "C") # use default (C) locale
+>>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
 \end{verbatim}
 
 \subsection{Background, details, hints, tips and caveats}
index c4c5506569494735ed1940043290440f1da44e2e..6425797d437e2e8a0cdcd152bb14d0dd2c9e825e 100644 (file)
@@ -184,9 +184,12 @@ Example:
 
 \begin{verbatim}
 >>> import locale
->>> locale.open(locale.LC_ALL,"de") #setting locale to German
->>> locale.strcoll("f\344n","foo")  #comparing a string containing an umlaut 
->>> can.close()
+>>> loc = locale.setlocale(locale.LC_ALL) # get current locale
+>>> locale.setlocale(locale.LC_ALL, "de") # use German locale
+>>> locale.strcoll("f\344n", "foo") # compare a string containing an umlaut 
+>>> locale.setlocale(locale.LC_ALL, "") # use user's preferred locale
+>>> locale.setlocale(locale.LC_ALL, "C") # use default (C) locale
+>>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale
 \end{verbatim}
 
 \subsection{Background, details, hints, tips and caveats}