Woody's Python Study Notes 4, woodypython

Source: Internet
Author: User

Woody's Python Study Notes 4, woodypython

Python Module

Import Statement

To use the Python source file, you only need to execute the import Statement in another source file. The syntax is as follows:

Import module1

When the interpreter encounters an import Statement, the module will be imported in the current search path. The search path is a list of all directories that the interpreter will first search.

From... Import Statement

The from Statement of Python allows you to import a specified part from the module to the current namespace. The syntax is as follows:

From modname import name: for example, to import the function of the fib module:

From fib import maid

When importing a Python module, the interpreter searches for the module in the following order:

First, it is the current directory. If it is not in the current directory, python searches for each directory under the shell variable PYTHONPATH. If it cannot be found, python will view the default path, in unix, the default path is/usr/local/lib/python.

 


Which of the following is the Python core programming (version 2nd) and Python learning Manual (version 4th) that is more suitable for beginners and practical?

I used core programming at the time. If you want to learn what you want, you can search for information on the Internet. These two books are the most basic syntax. For example, python cookbook.

Which of the following is the Python core programming (version 2nd) and Python learning Manual (version 4th) that is more suitable for beginners and practical?

The python learning manual is better, and the python core programming book is not good! It is best to read the official documentation. Of course, it is better to use English.

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.