Home  >  Article  >  Backend Development  >  Why is python more suitable for writing script files?

Why is python more suitable for writing script files?

WBOY
WBOYOriginal
2016-08-31 08:54:501560browse

Why does everyone recommend writing scripts in Python? Does Python have any special advantages? I feel like there is no qualitative advantage over PHP?
Like node.js, it is still asynchronous, so I think it is more suitable for writing scripts, but what about Python? Why?

Because I am planning to write a script recently, I am struggling with which language to use to write Python/PHP.
Please ask experienced friends for advice.

Reply content:

Why does everyone recommend writing scripts in Python? Does Python have any special advantages? I feel like there is no qualitative advantage over PHP?
Like node.js, it is still asynchronous, so I think it is more suitable for writing scripts, but what about Python? Why?

Because I am planning to write a script recently, I am struggling with which language to use to write Python/PHP.
Please ask experienced friends for advice.

I think there are probably two reasons:

  1. On the one hand, it is the characteristics of Python’s own language, which is simple, clear and elegant.
    Many scripting languages ​​require writing some small tools to solve problems, and do not care much about performance. This language is easy to learn and therefore is often used.

  2. On the one hand, it may be due to Python’s complete third-party libraries. For example:
    In the field of scientific computing, there are: Matplotlib, SciPy, NumPy
    In the field of image processing, there are: PIL
    In the field of web page parsing, there are: BeautifulSoup
    These third-party libraries can make programs write scripts with twice the result with half the effort.

  • Simple syntax

  • Fast development speed

  • Every third-party library is available

Simple, low learning cost, cross-platform, and highly compatible with other languages, so it is a good glue language. Coupled with a large number of third-party libraries, it covers a large amount of content such as networks, files, GUIs, databases, texts, etc. Can do interface, web, games, big data, machine learning, etc. The philosophy of Python is to be simple and elegant, try to write code that is easy to understand, and try to write as little code as possible. Okay, Amway is over, director, where is my lunch box.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn