Notes for using Python

Source: Internet
Author: User

When using Python, you need to pay attention to many issues. First, you need to understand what Python is. In fact, this language has very simple and clear syntax features and is suitable for completing various high-level tasks, it can be run in almost all operating systems.

I want to talk about python as the most beautiful programming language on the planet. It is said that some schema languages are very cool, and I keep my opinion before I learn them. What can Python do? Www.python.org can find the answer. Basically, you can ask what python cannot do. Let me tell you what to do with python.

1. Calculator
Python shell is a good command line calculator that supports a variety of complex computation methods. After using it, my mental computing capabilities are greatly reduced.

2. process various texts
Remove some articles from the Internet, and delete the blank lines in them. There are large numbers without rules, which need to be summed; header file conversion in different formats and so on;

This process is better with perl. I did the same three years ago. When I used Python, I gave up perl completely. Perl is very good. Basically, it has the same function. Writing code using python will take longer. The network community provides more perl function packages, but Larry Wall is a poet, the poet's temperament makes perl's syntax look messy in the eyes of our programmers.

Basically it's not needed for two weeks. If you want to work with perl, you have to look for a grammar book. In linux, it's okay. You can have one man. If you have an ActivePerl installed on windows, you have to open the html file Perl Core Documentation to search for it in one line, even though the Help System of the script language cannot

The help of commercial development tools such as. Net and Java is comparable, but python also has a chm file that can be indexed. Perl is used for real hacker. It is concise and clear, but it is the advantage of python. If you select perl as a professional network administrator, It's right. As for the small toys of common programmers, python is better.

3. Develop various prototype systems quickly.
Interface, network, text processing, image processing, and scientific computing. Desktop programs can use the wxpython library, which is not slow. Python has strong network programming capabilities. Its modules are all written in c/c ++.

In addition to the PIL package that comes with python, you can also use ImageMagic, so that Gimp can do anything, python can do anything, and write 10 lines of programs to process a large number of images, there is not much such pleasure. Three years ago, I helped JJ write a program to process satellite images. It was about to cut the satellite cloud map into 32*32 squares, calculate the threshold values in sequence, and then make statistics. I spent all the afternoons of the week.

Pure c, almost 1500 lines of code. At that time, he was in love and had a low IQ. In windows, he installed a gcc and used editplus as the editor. gdb + printf was used for debugging, although I had a sense of accomplishment in the end, it really took a lot of effort. The core part of the program should be done in just a few lines if python is used.

 
 
  1. import socket, sys   
  2. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)   
  3. s.connect((host, port))   
  4. try:   
  5.     s.connect((host, port))   
  6.         s.send(.)   
  7. except IOError:   
  8.     pass:  

Of course, if you use Python for image processing algorithm research, we recommend using matlab. The efficiency of python's floating point operation is relatively low, because the number of floating point digits in python can be almost unlimited, similar to the Big Int processing method.

  1. How to embed Python into C ++ applications?
  2. In-depth discussion of Ruby and Python syntax comparison
  3. Introduction to Python
  4. Python Learning Experience: version, IDE selection and coding Solutions
  5. Analysis of Python GIL and thread security

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.