[Python-checkins] cpython (2.7): #5904: Add sentence about the encoding of strftime's result.

r.david.murray python-checkins at python.org
Fri Jun 13 23:23:48 CEST 2014


http://hg.python.org/cpython/rev/31adcc4c4391
changeset:   91168:31adcc4c4391
branch:      2.7
user:        R David Murray <rdmurray at bitdance.com>
date:        Fri Jun 13 17:23:34 2014 -0400
summary:
  #5904: Add sentence about the encoding of strftime's result.

files:
  Doc/library/time.rst |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Doc/library/time.rst b/Doc/library/time.rst
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -236,7 +236,9 @@
    :func:`gmtime` or :func:`localtime` to a string as specified by the *format*
    argument.  If *t* is not provided, the current time as returned by
    :func:`localtime` is used.  *format* must be a string.  :exc:`ValueError` is
-   raised if any field in *t* is outside of the allowed range.
+   raised if any field in *t* is outside of the allowed range. :func:`strftime`
+   returns a locale depedent byte string; the result may be converted to unicode
+   by doing ``strftime(<myformat>).decode(locale.getlocale()[1])``.
 
    .. versionchanged:: 2.1
       Allowed *t* to be omitted.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list