Skip to main content

Introduction

Introduction

Python is an interpreted language that does not require compilation and linking, which saves a lot of development time.

Python programs are concise, easy to read, and often much shorter than C, C++, or Java code that implements the same functionality, for several reasons.

  • High-level data types allow complex operations to be expressed in a single statement.
  • The use of indentation, rather than parentheses, to group blocks of code.
  • no need to pre-declare variables or parameters.

Run

Installation

Python official website: https://www.python.org/, choose the appropriate version to install.

Using

The interactive interpreter can be run by typing Python into the shell, and Python scripts can be written inside the interpreter to run it. If you need to exit, type quit().

Character encoding of source files

Python source files are encoded in UTF-8; if you don't use the default encoding, declare the encoding of the file, and write the first line of the file as a special comment. The syntax is as follows.

# -*- coding: encoding -*-