diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2012-08-10 12:40:37 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2012-08-10 12:40:37 +0100 |
| commit | 184cf9ab798d5b25d855649ddb2ca580949778df (patch) | |
| tree | 8512633ec04a6979b0953e32e73c9a43d09e5805 /docs/topics/python3.txt | |
| parent | c4b2a3262cc79383d6562cfc7e9af20135c8e0bf (diff) | |
| parent | 7275576235ae2e87f3de7b0facb3f9b0a2368f28 (diff) | |
Merge branch 'master' into schema-alteration
Diffstat (limited to 'docs/topics/python3.txt')
| -rw-r--r-- | docs/topics/python3.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/topics/python3.txt b/docs/topics/python3.txt index 3f799edac7..b09c1d2347 100644 --- a/docs/topics/python3.txt +++ b/docs/topics/python3.txt @@ -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 |
