Python redis rpop is resultng b'value' list structure
<p>I am working on a simple redis and flask project using docker compose. my flask manuplates redis list structure using lpush, rpop. It worked fine until i was playing with commands like brpop which now made all my results b'value'. I tried to work with the first commands only, but somehow the b'value' output keeps coming. Any idea on what might causing this?</p>

<pre><code>**redis.lpush('moviestore','likemov')

itle = redis.rpop('moviestore')**
</code></pre>

<p>It seems that redis strings are Python bytes strings (see the documentation about <a href="http://redis.io/topics/data-types" rel="nofollow">Data Types</a>).</p>

<p>So, I think there is a automatic conversion from Unicode to Bytes in Python 3 (and maybe in Python 2 too).</p>

<p>To work with Unicode string, you can encode/decode sting (using UTF8 encoding for instance):</p>

<pre><code>redis.lpush('moviestore', u'likemov'.encode('utf8'))
...
itle = redis.rpop('moviestore').decode('utf8')
</code></pre>

<p>In summary:</p>

<ul>
<li>to store Unicode string in Redis: you encode it,</li>
<li>to retrieve Unicode string from Redis: you decode it.</li>
</ul>

<p>Notice the differences:</p>

<ul>
<li>by default, 'value' is a <code>str</code> which is a Bytes string in Python 2 and an Unicode string in Python 3.</li>
<li>u'value' is an Unicode string: py2 <code>unicode</code> / py3 <code>str</code>;</li>
<li>b'value' is a Bytes string: py2 <code>str</code> / py3 <code>bytes</code>.</li>
</ul>

python list redis docker-compose