728x90
반응형
Redis 접속 후 리턴값 옵션 설정
기본적으로 python에서 redis에서 정보를 get 해올 때, b''로 값이 출력된다.
이때 b의 의미와 이걸 제거하고 값만 출력하도록 옵션 설정을 한다.
def connect_redis():
redis_host = config['redis']['host']
redis_port = config['redis']['port']
redis_db = config['redis']['db']
rd = redis.Redis(host=redis_host, port=redis_port, db=redis_db, charset="utf-8", decode_responses=True)
return rd
Reference
반응형
'Programming Language > [Python]' 카테고리의 다른 글
[Python] pymysql connection option (0) | 2023.06.21 |
---|---|
[Python] Jinja template (0) | 2023.04.30 |
[Python] datetime format (0) | 2023.04.18 |
[Python] sqlalchemy - text (0) | 2023.04.18 |
[Python] PID 의미 (0) | 2023.04.15 |