python操作redis-事务

#!/usr/bin/python
#!coding: utf-8

import redis
import sys

if __name__=="__main__":
    try:
        conn=redis.StrictRedis('192.168.80.41')
        pipe=conn.pipeline()
        pipe.sadd('s001','a')
        sys.exit()
        #在事务还没有提交前退出,所以事务不会被执行。
        pipe.sadd('s001','b')
        pipe.execute()
        pass
    except Exception as err:
        print(err)
        pass
原文地址:https://www.cnblogs.com/JiangLe/p/5415763.html