Previous article: The contents of the Python tutorial (Chapter 1) are itemized
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.
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/
--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)
--For UNIX
--Python installation location
--Usually installed as /usr/local/bin/python3.5.
The directory can be specified at the time of installation.
--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.
--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.
--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