The example you give does not make sense, since you can only pass parameters by either POST or GET, but not both at once. I think if you ran your example then the browser would either ignore the "?a=1" part of the URL, or give an error.
However you can tell how the parameters were passed by checking the 'REQUEST_METHOD' environment variable, which should be either 'GET' or 'POST'. (I think it can also be 'HEAD', but this is rarely used).
Dave - The Developers' Coach
if os.environ['REQUEST_METHOD'] == 'GET':
print 'processing GET request'
elif os.environ['REQUEST_METHOD'] == 'POST':
print 'processing POST request'
print 'unknown request type'