conn = RedisCluster(startup_nodes=nodes,
decode_responses=True, cluster_down_retry_attempts=20)
conn.hset('test','ab',"['122']")
print(conn.hgetall('test'))
print(eval(conn.hget('test','ab')))
Output :
{
'ab': "['122']"}
['122']
If [‘122’] An error will be reported if the list is used to import :
redis.exceptions.DataError: Invalid input of type: 'list'. Convert to a bytes, string, int or float first.