Results 1 to 1 of 1
Feb 6, 2013, 10:28 #1
- Join Date
- Nov 2010
- 0 Post(s)
- 0 Thread(s)
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 (abc.py).
$mind = explode(',', $_GET['mind']);
$data = '';
$data .= file_get_contents('good.txt');
$data .= file_get_contents('bad.txt');
I would be grateful if anyone can get me the converted lines to Python.
So that whenever I run, http://localhost:8080/abc?mind=good,bad 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(',') self.response.out.write(splitted) application = webapp.WSGIApplication([('/abc?', PrintAccordingly)], debug=False) def main(): run_wsgi_app(application) if __name__ == "__main__": main()I love to help and also to get helped.