티스토리 뷰
python에서 redis 연결하여 사용할 경우 "b" 문자가 출력됨
>>> r = redis.StrictRedis(host='localhost', port=6379, db=0)
>>> r.set('test_redis', 'Hello Python')
>>> r.get('test_redis')
b'Hello Python' --> byte 문자열이란 뜻으로
해결을 위해서는 다음 unicode를 명시적으로 사용하여 수정함.
>>> r = redis.StrictRedis(host="localhost", port=6379, charset="utf-8", decode_responses=True)
>>> r.set('test_redis', 'Hello Python')
>>> r.get('test_redis')
'redis' 카테고리의 다른 글
python에 redis 라이브러리 설치 (0) | 2016.05.16 |
---|---|
ubuntu에서 redis 설치 (0) | 2016.05.06 |
댓글