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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -