How nicely does Python 'flow' with HTML as compared to PHP?

后端 未结 5 1879
臣服心动
臣服心动 2021-02-08 02:51

I\'m thinking of switching from using PHP to Python for web applications, but I was wondering if Python is as adept as weaving in and out of HTML as PHP is. Essentially, I find

5条回答
  •  有刺的猬
    2021-02-08 03:31

    Well. First of all, you must know that mixing code with presentation is considered bad practice. Although you can use template engines that let you mix any python code inside the html, like Mako, usually python web libraries and frameworks tend to favor writing logic on a python script file and a separate html template to render the results.

    That said, python is much easier than PHP.

    But you can only be productive in python If you're willing to learn its way of programming.

    If you want PHP, nothing is more PHP than PHP itself, and python takes different approaches, so maybe you're going to be frustrated because things are not like you're used to.

    However, if you are searching for a new, better way of doing things, python is for you.

    After reading the basic python tutorial, try some python web framework like pylons and see for yourself.

提交回复
热议问题