Results 1 to 3 of 3
Essentially I'm working on a gallery script (which I'm calling view_image.py), and I get the number of the image to display from the url via cgi.FieldStorage. I'm currently using
Code:
...
- 06-10-2007 #1
Python: get numerical parameter from cgi.FieldStorage
Essentially I'm working on a gallery script (which I'm calling view_image.py), and I get the number of the image to display from the url via cgi.FieldStorage. I'm currently using
So if I navigate to view_image.py?image_id=1001, that'll give meCode:source = cgi.FieldStorage() image_id = source['image_id'].value
Unfortunately that means that image_id is a string, and I need to be able to manipulate it numerically, so I need it as an int instead. I'm sure it must be possible to get a url parameter as a numeral, but I've yet to find anything on google. Does anyone have any ideas?Code:image_id='1001'
Thanks for taking the time to look at this
Toodle-oo
Giles"Our greatest fear is not that we are powerless. Our greatest fear is Microsoft"
Registered linux user #391027
- 06-11-2007 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
you can turn it into integer,eg image_id=int(image_id)
- 06-11-2007 #3
Awesome. Thanks very much.
Giles"Our greatest fear is not that we are powerless. Our greatest fear is Microsoft"
Registered linux user #391027


Reply With Quote