I do not know ruby but I know python. What is the python equivalent for running the below code? This example was taken from the redis website. So, what is this?
<<EOF?
would it be in python:
RandomPushScript = """
Lua code here
"""
RandomPushScript = <<EOF
local i = tonumber(ARGV[1])
local res
math.randomseed(tonumber(ARGV[2]))
while (i > 0) do
res = redis.call('lpush',KEYS[1],math.random())
i = i-1
end
return res
EOF
r.del(:mylist)
puts r.eval(RandomPushScript,1,:mylist,10,rand(2**32))
The
<<indicates a HereDoc. After it there is a marker (hereEOF). The next lines are a string, until the marker appears again.So yes,
"""would be the Python equivalent.