You are not logged in.
Pages: 1
Im fiddling around with python and web.py.
My problem:
If i go to localhost:8080/generatearray/value1/value2/.../valueN/
I want that the class "generatearray" generates an array with the values given in the path.
Im far from advanced in python or programming at all, so it would be nice if someone could give me a hint.
Offline
I haven't used webpy in ages, but I believe this will work.
In your urls variable you can create something like so:
urls = (
'/generatearray/(.*)', 'generatearray'
)
And now anything that follows generatearray/ in the address will be matched.
On to the generatearray class:
class generatearray:
def GET(self, stuff):
my_array = stuff.split('/')
etc
So now a call to localhost:8080/generatearray/one/two/three should make my_array there ['one', 'two', 'three']
Cthulhu For President!
Offline
ouch i thought in the totally wrong direction... your approach works great! thank you!
Offline
Pages: 1