redis复习二
//在python shell完成以下操作 //连接redis import redis client=redis.Redis()
client.rpush(“list3”,“python”) 1
client.lpush(“list3”,“list is short!”) 2
client.rpush(“list3”,22,“seven”,3.14) 5
datas=[“one”,“two”,“three”] *client.rpush(“list3”,datas) 8
print(client.lrange(“list3”,0,-1)) [b’list is short!’, b’python’, b’22’, b’seven’, b’3.14’, b’one’, b’two’, b’three’]
for k in client.lrange(“list3”,0,-1): print(k.decode()) KeyboardInterrupt
for k in client.lrange(“list3”,0,-1): print(k.decode());
list is short! python 22 seven 3.14 one two three client.lpop(“list3”) b’list is short!’
print(client.lset(“list3”,4,“hellow world!”)) True
data={‘phone_number’:‘1502919112’} print(type(data)) <class ‘dict’>
|