summaryrefslogtreecommitdiffstats
path: root/src/virtBootstrap/sources.py
diff options
context:
space:
mode:
authorRadostin Stoyanov <rstoyanov1@gmail.com>2017-07-21 13:13:17 +0100
committerRadostin Stoyanov <rstoyanov1@gmail.com>2017-07-21 13:29:19 +0100
commit648965c97c82d1aee45de696bba5eec19aa722e4 (patch)
tree07966942b2d3e637d5cb2150e7fc3e7dc1cb9f0b /src/virtBootstrap/sources.py
parent0b0f8ce3b0af0a148517c4e3d9ab2d0e3a19def1 (diff)
downloadvirt-bootstrap.git-648965c97c82d1aee45de696bba5eec19aa722e4.tar.gz
virt-bootstrap.git-648965c97c82d1aee45de696bba5eec19aa722e4.tar.xz
virt-bootstrap.git-648965c97c82d1aee45de696bba5eec19aa722e4.zip
Python 3/2 compatibility: Convert Byte-str to Str
Encoded Unicode in Python 3 is represented as binary data. The difference with Python2 is that any attempt to mix text and data in Python 3.0 raises TypeError, whereas if you were to mix Unicode and 8-bit strings in Python 2.x, it would work if the 8-bit string happened to contain only 7-bit (ASCII) bytes, but you would get UnicodeDecodeError if it contained non-ASCII values. Reference: https://docs.python.org/release/3.0.1/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit Example: Python 2: >>> b'foo.bar'.split('.') ['foo', 'bar'] Python 3: >>> b'foo.bar'.split('.') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: a bytes-like object is required, not 'str' >>> b'foo.bar'.split(b'.') [b'foo', b'bar']
Diffstat (limited to 'src/virtBootstrap/sources.py')
0 files changed, 0 insertions, 0 deletions