After 1 complete day, I figured out a way to get the GET parameters in a python file.
Now on my URL localhost:8080/test_file?mood=good,bad, I want to explode a GET parameter just like we do in PHP with explode(',', $_GET['mood'])
In python I wrote:
mymood = cgi.escape(self.request.get('mood'))
Where I get good,bad on command self.response.out.write(mymood)
But when I use the .split function, then I am confused now, how to use decision statements like if else in this. (Actually I want to use like in_array in PHP – i.e. if good is there in the mymood python variable)
I wrote:
splitted = mymood.split(',')
and, it gives [u'good', u'bad'] on command self.response.out.write(splitted)
How can I handle explode the get parameter and check it by using if else or in_array (just like PHP) in Python Google App Engine?
You can just do:
It is the equivalent of the PHP