Redis lua scripting - What is the python equivalent of the lua script written in Ruby? -
i not know ruby know python. python equivalent running below code? example taken redis website. so, this?
<<eof? would in python:
randompushscript = """ lua code here """ randompushscript = <<eof local = tonumber(argv[1]) local res math.randomseed(tonumber(argv[2])) while (i > 0) res = redis.call('lpush',keys[1],math.random()) = i-1 end return res eof r.del(:mylist) puts r.eval(randompushscript,1,:mylist,10,rand(2**32))
the << indicates heredoc. after there marker (here eof). next lines string, until marker appears again. yes, """ python equivalent.
Comments
Post a Comment