Explorar o código

Redis pop bytes

transfer bytes to str
newlyedward %!s(int64=9) %!d(string=hai) anos
pai
achega
2a45003117
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      DB/RedisClient.py

+ 3 - 2
DB/RedisClient.py

@@ -48,7 +48,7 @@ class RedisClient(object):
         pop an item
         :return:
         """
-        return self.__conn.spop(self.name)
+        return self.__conn.spop(self.name).decode('utf-8')                    #redis return bytes
 
     def delete(self, value):
         """
@@ -77,9 +77,10 @@ if __name__ == '__main__':
     # print(redis_con.getAll())
     # redis_con.delete('abc')
     # print(redis_con.getAll())
-    # redis_con.pop()
+
     # print(redis_con.getAll())
     redis_con.changeTable('raw_proxy')
+    redis_con.pop()
 
     # redis_con.put('132.112.43.221:8888')
     # redis_con.changeTable('proxy')