首页 > 解决方案 > 使用 Redis 和 Python 保存德语变音符号

问题描述

我用 python 保存了一些 URL,不幸的是它们包含德语变音符号(ä、ö、ü)。如果它现在保存在 Redis 中,而不是 "baden-württemberg" 我得到 "baden-w\xc3\xbcrttemberg"

redis_client = redis_con()

    # seitenlink in redis speichern
    for i in range(0, seitenAnzahl):
        link = url[:-6] + (str(i)) + ".html"
        link_hash = hashlib.md5(str(link).encode('utf-8', 'ignore')).hexdigest()

        reg = "tpl_regioLinks"
        redis_client.hset(reg, link_hash, link)

标签: pythonredischaracter-encoding

解决方案


推荐阅读