Python Tutorials

Tutorial for Beginners: Using the Python Interpreter

Submitted byadmin onSat, 03/23/2019 - 15:59

This article introduces the reader informally to the concepts and characteristics basic language and Python system and Python Interpreter.

Introduction

Python is a powerful and easy-to-learn programming language. It has efficient and high-level data structures and a simple but effective approach to programming object oriented The elegant syntax of Python and its dynamic typing, together with its interpreted nature, make this an ideal language for scripting and rapid development of applications in various areas and on most platforms.

Python Interpreter

The Python interpreter and the extensive standard library are freely available in binary and source code for the main platforms from the Python website, http://www.python.org/, and can be freely distributed. The same site also contains distributions and links of many free third-party Python modules, programs and tools, and additional documentation.

The Python interpreter can easily be extended with new features and types of data implemented in C or C ++ (or other languages ​​accessible from C). Python it can also be used as an extensions language for customizable applications.

Using the Python Interpreter

In general, the Python interpreter is installed in file: / usr / local / bin / python on the machines where it is available; put / usr / local / bin in the search path of your Unix command interpreter makes it possible to start it by typing the command:

python

In the terminal. Since the choice of directory where the interpreter will live is an option of installation process, may be in other places; consult your local Python Guru or systems administrator. (For example, / usr / local / python is a popular alternative).

On Windows machines, the installation of Python is usually found in C: \ Python26, although it can be changed during installation. To add this directory to the path, you can type the following command at the DOS prompt:

set path =% path%; C: \ python26

You can exit the interpreter with zero output status by typing the end character of file (Control-D in Unix, Control-Z in Windows) at the primary prompt. If this does not it works, you can exit the interpreter by typing the following command:

import sys; sys.exit ()

The features to edit interpreter lines are not very sophisticated. In Unix, who install the interpreter will have support for the GNU read lines library enabled, which Add a more elaborate interactive edition and history. Maybe the fastest way to detecting if the editing features are present is typing Control-P in the first Python prompt that appears. If a beep is heard, features are present; see Appendix tut-interacting for an introduction to the keys. If nothing happens, or if ^ P appears, these features are not available; you will only be able to use backspace to erase the characters of the current line.

The interpreter's way of operating is similar to the Unix command line: when the flame with the standard input connected to a tty device, reads and executes commands in interactive form; when it is called with a file name as an argument or with a file as standard input, reads and executes a file script.

A second way to start the interpreter is python -c command [arg] ..., which executes the statements in command, similar to the -c option in the command line. Already that Python statements often have blank spaces or other characters that are specials in the command line, it is better to quote command in double quotes.

Some Python modules are also useful as scripts. They can be invoked using python -m module [arg] ..., which executes the module code as if I had typed his full name on the command line.

Note that there is a difference between python file and python

When using a script, it is sometimes useful to run the script first and then enter interactive mode. This can be done by passing the -i option before the name of the script. (This does not work if the script is read from the standard input, for the same reason explained in the previous paragraph).

Need a Professional Help in Salesforce?

Here at Yexaa, we provide professional Python Job Support to all over the world. No matter you are a student, aspirant, fresher, or even a professional, we will not only provide Job Support to you, we will resolve all issues regarding Python but will also provide you enough training to deal with all kinds of difficult tasks that may come in this particular area of work.

Contact us now and get a positive response from our side not in days but in a few minutes.