3-1-5-21. The Standard Library

This is the Python standard library.

Up here, you see built-in objects we use throughout this course;

like built-in functions, data types, and exceptions.

Below that though, are tons of useful modules that you can import.

Think of this library as a very big set of

tools that you can use to help you program in Python.

It provides new types of objects and

functions for a range of common and specialized tasks.

Other people have already written

this code and put it into useful modules for you to use.

Using modules from the Python standard library to

easily access and use existing code gives you a lot of programming power.

The Python standard library is organized into modules.

Many modules are simply Python files,

like the Python scripts you’ve already written and imported.

Let’s import this math module.

Again, an import statement runs the code in the module.

Modules typically contain a lot of definitions and usually don’t show any output.

Running the code will make

all the modules’ functions and types of objects available to use.

Math has a factorial function,

which finds the product of a number and all the positive integers less than it.

Four times three, times two,

times one is 24,

so math.factorial(4) for prints 24.

The Python standard library has good documentation for each of its modules,

and it’s a good idea to read the relevant page whenever you use one.

Here’s a documentation for the math module.

So far, you’ve seen only one module in the Python standard library.

It’s a good one, but there are many more.

If you look at the documentation for the whole of the Python standard library,

modules are listed in groups based on their uses.

Clicking on a name takes you to the documentation for that module,

which often includes example code that you should feel free to test out.

자신의 모듈을 가져오는 것이 얼마나 도움이 될 수 있는지 보았습니다.

그러나 내가 당신에게 거기에 있다고 말하면 어떻게 될까요?

Python과 함께 제공되는 내장 모듈의 전체 라이브러리?

이것은 파이썬 표준 라이브러리입니다.

여기에서 이 과정에서 사용하는 기본 제공 개체를 볼 수 있습니다.

내장 함수, 데이터 유형 및 예외와 같은.

그 아래에는 가져올 수 있는 유용한 모듈이 많이 있습니다.

이 라이브러리를

Python에서 프로그래밍하는 데 사용할 수 있는 도구입니다.

새로운 유형의 객체를 제공하고

다양한 공통 및 특수 작업에 대한 기능.

다른 사람들이 이미 썼습니다.

이 코드를 사용하여 유용한 모듈에 넣습니다.

Python 표준 라이브러리의 모듈을 사용하여

기존 코드에 쉽게 액세스하고 사용하면 많은 프로그래밍 능력을 얻을 수 있습니다.

Python 표준 라이브러리는 모듈로 구성됩니다.

많은 모듈은 단순히 Python 파일입니다.

이미 작성하고 가져온 Python 스크립트와 같습니다.

이 수학 모듈을 가져오겠습니다.

다시, import 문은 모듈의 코드를 실행합니다.

모듈은 일반적으로 많은 정의를 포함하며 일반적으로 출력을 표시하지 않습니다.

코드를 실행하면

사용 가능한 모든 모듈의 기능과 객체 유형.

수학에는 계승 함수가 있고,

숫자와 그보다 작은 모든 양의 정수의 곱을 찾습니다.

네 번 세 번, 두 번,

곱하기 1은 24이고,

그래서 math.factorial(4)는 24번을 인쇄합니다.

Python 표준 라이브러리에는 각 모듈에 대한 좋은 문서가 있습니다.

사용할 때마다 관련 페이지를 읽는 것이 좋습니다.

다음은 수학 모듈에 대한 문서입니다.

지금까지 Python 표준 라이브러리에서 하나의 모듈만 보았습니다.

그것은 좋은 것입니다. 그러나 더 많은 것이 있습니다.

파이썬 표준 라이브러리 전체에 대한 문서를 보면,

모듈은 용도에 따라 그룹으로 나열됩니다.

이름을 클릭하면 해당 모듈에 대한 설명서로 이동합니다.

여기에는 자유롭게 테스트할 수 있는 예제 코드가 포함되는 경우가 많습니다.

The Standard Library

You can discover new modules at the Python Module of the Week blog.

https://pymotw.com/3/

%d