Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). Python is named after a TV Show called ‘Monty Python’s Flying Circus’ and not after Python-the snake.
Python 3.0 was released in 2008. Although this version is supposed to be backward incompatibles, later on many of its important features have been backported to be compatible with version 2.7.
Audience
This tutorial is designed for software programmers who want to upgrade their Python skills to Python 3. This tutorial can also be used to learn Python programming language from scratch.
Audience
This tutorial is for software developers who want to upgrade their Python skills to Python 3. This tutorial can also be used to learn the Python programming language from scratch.
The necessary conditions
You must have a basic understanding of the terms of computer programming. The basic understanding of any of the programming languages is a plus.
Executing Python programs
The Python program files has the extension py. Programs are run using the Python interpreter.
For example, such a program written in the file main.py
#!/usr/bin/python3 print ("Hello, Python!")
You can run it by running the following command in the console
python3 main.py
The output will be as follows
Hello, Python!
Overview
Python is a high-level, interpretable, interactive and object-oriented scripting language. Python is designed to be readable. He often uses English keywords, while other languages use punctuation. It has fewer syntactic constructions than other languages.
-
Python is interpreted - Python is processed at run-time by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
Python is interactive - you can use Python hints and interact directly with the interpreter to write your own programs.
Python is object-oriented. Python supports an object-oriented programming style that is encapsulated within objects.
Python is a language for beginners. Python is an excellent language for novice programmers and supports the development of a wide range of applications from simple text processing to web browsers for games.
History of Python
Python was developed by Guido van Rossum in the late 80s and early nineties at the National Research Institute of Mathematics and Informatics in the Netherlands.
- Python is derived from many other languages, including ABC, Modula-3, C, C ++, Algol-68, SmallTalk and Unix shell and other scripting languages.
- Python is protected by copyright. Like Perl, the Python source code is now available under the GNU General Public License (GPL).
- Python is now supported by the core development team at the institute, although Guido van Rossum still plays a vital role in guiding his progress.
- Python 1.0 was released in November 1994. In 2000, Python 2.0 was released. Python 2.7.14 is the latest version of Python 2.
- Meanwhile, Python 3.0 was released in 2008. Python 3 is not compatible with Python 2. Compatibility with Python 3 was to remove duplicate software constructs and modules to "have one, and maybe one, an obvious way to do this." Python 3.6.4 is the latest version of Python 3.
Python Features
Ease of learning - Python has several keywords, a simple structure and a well-defined syntax. This allows the student to quickly pick up the language.
- Easily readable - the Python code is more clearly defined and visible to the eyes.
- Easy-to-maintain - Python source code is fairly easy to maintain.
- Wide standard library - the main part of the Python library is very portable and cross-platform compatible with UNIX, Windows and Macintosh.
- Interactive mode - Python supports interactive mode, which allows you to interactively test and debug code snippets.
- Portable - Python can run on a variety of hardware platforms and have the same interface on all platforms.
- Expandable - you can add low-level modules to the Python interpreter. These modules allow programmers to add or customize their tools to improve efficiency.
- Databases - Python provides interfaces for all major commercial databases.
- Programming GUI - Python supports graphical applications that can be created and transferred to many system calls, libraries and Windows systems, such as Windows MFC, Macintosh and X Window Unix systems.
- Scalability - Python provides better structure and support for larger programs than shells.
In addition to the above functions, Python has a large list of good functions. A, few are listed below -
- It supports functional and structured programming methods, as well as OOP.
- It can be used as a scripting language or can be compiled into bytecode to create large applications.
- It provides very high-level dynamic data types and supports dynamic type checking.
- It supports automatic garbage collection.
- It can be easily integrated with C, C ++, COM, ActiveX, CORBA and Java.
Добрый день!
Вот это линуксовая директива
Указывает, где находится python пакет в системе. А вы видимо под windows разрабатываете.
Попробуйте просто удалить эту строку.
Я надеюсь вы уже разобрались в чем дело, но если вдруг нет, то проблема состоит в том, что вы пытаетесь запустить программу из интерпретатора питона.
Файл main.py это уже готовая программа которая выводит в терминал (командную строку) текст:
Эту (готовую) программу нужно запускать из интерпретатора команд вашей ОС (Windows: cmd, powershell; UNIX: bash, zsh, csh ...) а не из интерпретатора питона.
Текст файла main.py :
Программа для запуска из выполняемой среды ОС (открыть файл main.py в программе python ):
если же вы уже запустили интерпретатор python, то вам достаточно просто написать команду: