The contents of the Python tutorial (Chapter 10) are itemized.

Previous article: A bulleted list of the contents of the Python tutorial (Chapter 9) (under construction)

Introduction

Python3 Engineer Certification Basic Exam As a countermeasure, this is a personal memo that summarizes the contents of the Python tutorial (book) in easy-to-memorize bullet points.

Reference material

Python Tutorial: https://docs.python.org/ja/3/tutorial/ Chapter 10: https://docs.python.org/ja/3/tutorial/stdlib.html Books: https://www.oreilly.co.jp/books/9784873117539/

"Chapter 10 Standard Library Tour"

--Python3 Engineer Certification Basic Exam Score ―― 4/40 questions (10.0%) ☆☆ ★★★ (Importance: Medium-) --Theme --Standard library

10.1 OS interface

-** os module ** provides functions to interact with the OS. -* os.getcwd () * # Get the current directory -* os.chdir ('/ server / accesslogs') * # change current directory -* os.system ('mkdir today') * # Command execution in the shell on the system side -** shutil module ** provides functions to manage files and directories. -* shutil.copyfile ('data.db','archive.db') * #copy the file -* shutil.move ('/ build / executables','installdir') * #Move files / directories

10.2 File wildcards

-** glob module ** provides a function to wildcard directories and return a list of filenames. -* glob.glob ('\ *. Py') * # \ * .py Search for files

10.3 Command line arguments

-The command line arguments are stored as a list in the ** argv attribute ** of the ** sys module . ---> For details, see ["2.1.1 Passing arguments"](https://qiita.com/Wakii/items/3a9efa210d2f602fa36e#211-%E5%BC%95%E6%95%B0%E3%82% See 92% E6% B8% A1% E3% 81% 99). - getopt module ** processes sys.argv like the UNIX getopt () function. - opts,args = getopt.getopt(args, shortopts, longopts=[]) -** argparse module ** provides powerful and flexible command line processing capabilities. - parser = argparse.ArgumentParser(description='Process some integers.') - args = parser.parse_args() - print(args.accumulate(args.integers))

10.4 Redirect error output (change destination) and exit program

--The sys module has the following attributes and methods in addition to argv. -** sys.stdin ** ... STDIN (standard input) file object -** sys.stdout ** ... STDOUT (standard output) file object -** sys.stderr ** ... STDERR (standard error output) file object -** sys.exit () ** ... Exit the script.

10.5 String pattern matching

-** re module ** provides a regular expression tool for advanced string processing. --For simple operations such as replacement, the ** string method ** is easier to read and debug.

10.6 Mathematics

-** math module ** gives you access to lower C library functions for floating point math. -** random module ** is used to get random numbers. -** statistics module ** is used to calculate basic statistics (mean, median, variance, etc.) of numerical data.

10.7 Internet access

--The following is an example of a module for Internet access. -** urllib.request module ** is used to get the data of the specified URL. -** The smtplib module is used to send ** mail.

10.8 Date and time

-** datetime module ** is used for date and time calculation and output format manipulation.

10.9 Data compression

--Modules that support data compression are provided for each compression format as follows. -** zlib module ** -** gzip module ** -** bz2 module ** -** lzma module ** -** zipfile module ** -** tarfile module **

10.10 Performance measurement

-** timeit module ** provides timer (time measurement) function of Python code. -** profile module ** provides the following program statistics. ――How often were each part called? ――How long did it take to execute each part? -** The pstats module ** provides information to format and display program statistics. ――As an aside, note that there are two typos here (timetit, pstrats) in books.

10.11 Quality control

-** doctest module ** provides a tool to scan the module and automatically validate the tests embedded in the docstring. -** unittest module ** provides a framework for unit testing like JUnit.

10.12 Batteries included

--Python has a philosophy of battery inclusion (Battery Included: ready to use). -** xmlrpc.client module ** and ** xmlrpc.server module ** allow easy implementation of remote procedure calls. -** email package ** is a library package that processes email messages. -** json package ** supports parsing (interpreting) JSON files. -** csv module ** supports direct read / write function of CSV file. --XML processing is supported by the following packages. -** xml.etree.ElementTree package ** -** xml.dom package ** -** xml.sax package ** -** sqlite3 module ** is a wrapper for SQLite database library, which provides a persistent database that can be updated and accessed with subtly non-standard SQL syntax. --Internationalization is supported by the following modules. -** gettext module ** -** locale module ** -** codecs package **

Next article: A bulleted list of the contents of the Python tutorial (Chapter 11) (under construction)

Recommended Posts

The contents of the Python tutorial (Chapter 5) are itemized.
The contents of the Python tutorial (Chapter 4) are itemized.
The contents of the Python tutorial (Chapter 2) are itemized.
The contents of the Python tutorial (Chapter 8) are itemized.
The contents of the Python tutorial (Chapter 1) are itemized.
The contents of the Python tutorial (Chapter 10) are itemized.
The contents of the Python tutorial (Chapter 6) are itemized.
The contents of the Python tutorial (Chapter 3) are itemized.
Get the contents of git diff from python
the zen of Python
Template of python script to read the contents of the file
Not being aware of the contents of the data in python
Reproduce the execution example of Chapter 4 of Hajipata in Python
[Maya Python] Crush the contents of the script 2 ~ list Notes
Reproduce the execution example of Chapter 5 of Hajipata in Python
Towards the retirement of Python2
About the ease of Python
About the features of Python
Simulation of the contents of the wallet
The Power of Pandas: Python
[Maya Python] Crush the contents of the script 3 ~ List unknown Plugins
[Maya Python] Crush the contents of the script 1 ~ Camera Speed Editor
[Data science memorandum] Confirmation of the contents of DataFrame type [python]
A Python script that compares the contents of two directories
How to check if the contents of the dictionary are the same in Python by hash value
The story of Python and the story of NaN
Easy encryption of file contents (Python)
[Python] The stumbling block of import
[Python of Hikari-] Chapter 09-03 Class (inheritance)
First Python 3 ~ The beginning of repetition ~
Understand the contents of sklearn's pipeline
Existence from the viewpoint of Python
pyenv-change the python version of virtualenv
Change the Python version of Homebrew
See the contents of Kumantic Segumantion
Python Math Series ⓪ Table of Contents
[Python] Understanding the potential_field_planning of Python Robotics
Review of the basics of Python (FizzBuzz)
Introductory table of contents for python3
About the basics list of Python basics
Learn the basics of Python ① Beginners
[python, ruby] fetch the contents of a web page with selenium-webdriver
Output the contents of ~ .xlsx in the folder to HTML with Python
[Python of Hikari-] Chapter 07-02 Exception handling (continuous execution of the program by exception handling)
Verification of the theory that "Python and Swift are quite similar"
Contents of reading VBA x Python fastest work technique Memo chapter1
[Python] A program that rotates the contents of the list to the left
I checked the contents of docker volume
Change the length of Python csv strings
Check the behavior of destructor in Python
[Python3] Understand the basics of Beautiful Soup
Pass the path of the imported python module
The story of making Python an exe
Learning notes from the beginning of Python 1
Check the existence of the file with python
About the virtual environment of python version 3.7
[Python] Understand the content of error messages
Python tutorial
I didn't know the basics of Python
How to compare if the contents of the objects in scipy.sparse.csr_matrix are the same
The result of installing python in Anaconda