1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Documented the trick used in 9908201d7f.

This commit is contained in:
Aymeric Augustin 2012-08-03 15:40:29 +02:00
parent 9908201d7f
commit 5aec69ed29

View File

@ -36,6 +36,11 @@ In order to enable the same behavior in Python 2, every module must import
my_string = "This is an unicode literal"
my_bytestring = b"This is a bytestring"
If you need a byte string under Python 2 and a unicode string under Python 3,
use the :func:`str` builtin::
str('my string')
Be cautious if you have to `slice bytestrings`_.
.. _slice bytestrings: http://docs.python.org/py3k/howto/pyporting.html#bytes-literals