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

Previous article: The contents of the Python tutorial (Chapter 1) are itemized

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 2: https://docs.python.org/ja/3/tutorial/interpreter.html Books: https://www.oreilly.co.jp/books/9784873117539/

"Chapter 2 How to use the Python interpreter"

--Python3 Engineer Certification Basic Exam Score --1/40 questions (2.5%) ☆ ★★★★ (importance: small) --Theme --Installing and starting / terminating the interpreter --How to get arguments --Interactive mode and prompt type --Source file encoding (character code specification)

2.1 Starting the interpreter

--For UNIX --Python installation location --Usually installed as /usr/local/bin/python3.5.
The directory can be specified at the time of installation.

2.1.1 Pass arguments

--The arguments when the script is started are assigned to ** sys.argv **. --sys is a built-in module that can be referenced by running * import sys *. --arvg is a list containing arguments and has a minimum length of 1. --If no script name or arguments are given, sys.argv [0] will be an empty string. --If the script name is "-" which means standard input, sys.argv [0] will also be "-". -When executed in the form of "-C command", sys.argv [0] becomes "-C". --When executed in the form of "-m module name", sys.argv [0] will be the full name of the specified module. --The options that follow the "-C command" and "-m module name" are left in sys.argv.

2.1.2 Interactive mode

--The interpreter is in ** interactive mode ** when reading commands from a tty (standard I / O terminal device). --In interactive mode, the interpreter displays: -** Welcome message ** ... Displayed first. Start with version and copyright. -** Primary prompt (>>>) ** ... Prompt for command input. -** Secondary prompt (...) ** ... Displayed when you enter an if statement, etc., prompting you to enter a continuation line.

2.2 Interpreter and its environment

2.2.1 Source code encoding

--Python source files are treated as UTF-8 encoded by default. --UTF-8 can handle characters in most languages in the world. --However, since the standard library uses only ASCII characters for identifiers (names of classes, variables, functions, etc.), it is better to copy them. --You need to use an editor that recognizes UTF-8 to edit the source code. --You can also use encodings other than UTF-8. --The method is to write the special comment line of * # * \ _ \ * \ _ coding: encoding name \ _ \ * \ _ * on the first or second line of the source. --A list of available encodings can be found in the codecs section of the library reference.

Next article: The contents of the Python tutorial (Chapter 3) are itemized

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
About the matter that the contents of Python print are not visible in docker logs
[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
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 ~
[Python] [Table of Contents Links] Python Programming
Understand the contents of sklearn's pipeline
[Translation] scikit-learn 0.18 Tutorial Table of Contents
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
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
[Introduction to Python] How to sort the contents of a list efficiently with list sort
[Python3] Rewrite the code object of the function
I didn't know the basics of Python