Please help in converting few lines of PHP code (.php) to a Python file (.py)


From 3 days, I am continuously making my efforts to get this thing to do in Python, which I can easily do in PHP.
I just want following lines from PHP file (abc.php) to Python (


$mind = explode(',', $_GET['mind']);
$data = '';
if(in_array('good', $mind))
	$data .= file_get_contents('good.txt');
if(in_array('bad', $mind))
	$data .= file_get_contents('bad.txt');
echo ($data);


Here whenever I run [B]http://localhost/abc.php?mind=good,bad[/B] I get the content combined of good.txt and bad.txt.
I would be grateful if anyone can get me the converted lines to Python.
So that whenever I run, [B]http://localhost:8080/abc?mind=good,bad[/B] it perform the same action as we can do in PHP.

I just wrote these lines, but it is waste I think.

import cgi

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class PrintAccordingly(webapp.RequestHandler):
    def get(self):
      mind = cgi.escape(self.request.get('mind'))
      splitted = mind.split(',')

application = webapp.WSGIApplication([('/abc?', PrintAccordingly)], debug=False)

def main():

if __name__ == "__main__":