Detailed description of the first Pthon script compiling Scheme

Source: Internet
Author: User

I like Pthon scripts very much, and I also like to sum up the lessons learned about Pthon scripts in my work. Next I will discuss in detail how to compile the first Pthon script in Pthon scripts, the following is a detailed description of the article.

Some scripts are written in python. These scripts are very practical, so I want to know the basic syntax of these scripts. When I first read the python script code, I felt that its syntax is similar to javascript, and it is also very good to write web scripts. In fact, his designers are also working at google. Python is also the first choice for many programmers. It should be very extensive and useful.

Here we will share with you the first program you have learned and written, hoping that it may be helpful to netizens who want to learn python. This program is used to estimate the Inductance Value of the integrated spiral inductor. Three estimation formulas are provided: wheeler, mohan, and monomial. Three inductance formats are displayed: Square, hexagonal, and octagonal inductance.

The program prototype is from the www-smirc.stanford.edu, the formula can refer to Mohan etc, "Simple Accurate ExpressionsPlanar Spiral Inductances ". The most unique aspect of a Pthon script is that it uses indentation, unlike other programs that use parentheses to identify the beginning and end of a block. "#" Is used as the annotation identifier. Import is used to call function modules. For example, commonly used sys, OS, string, and so on, such:

 
 
  1. import string  
  2. import sys  
  3.  

Or

 
 
  1. import strng,sys  
  2.  

You can also:

 
 
  1. from string import split  
  2.  

For example, if you want to use the split function, use the string. split () format if you use the import string function. If you use from string import split, you must use split () to apply it.

In addition, you can use import to call custom classes. For example, if you create a class in the test. py file, you can use import test to call classes in the file. After reading the above content, I hope you will understand the Pthon script.

Related Article

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.