Tag Archives: python string

Python online help

To consult the Python online help we need to type the help () command to receive information on the use of the python interpreter. After issuing the command, you receive a welcome message from the online help function that invites us in case we were beginners to see the tutorial available on the Internet at the following url:

http://docs.python.org/tutorial/:

>>> help()

Welcome to Python 3.6's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/3.6/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics". Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

In the online help, as already mentioned with the help () command, just enter the name of any module, keyword or topic to get help in drafting Python programs. To exit the online guide to return to the interpreter, simply type “quit”. Instead, to obtain a list of available modules, expected keywords or usable topics, you will need to type “modules”, “keywords”, or “topics”.

Each module then has a summary contained in the online help in which all its features are listed, while to list the modules whose synthesis contains a given word we will have to add it to the word modules. For example, to get information on the array module we will insert this name in the shell of the online help to get the information shown in the figure.

Python online help

It is therefore advisable to consult the online help of the Python interpreter whenever you find yourself having to use a Python resource that you do not know adequately; we have seen that through the help of the Python Interactive Shell it will be easy and immediate to obtain sufficient documentation.

USEFUL LINKS FOR THE TOPIC:

 

Python Interactive Shell

To start Python or more correctly to open the Python Interactive Shell just click on the Start menu to find the shell icon ready in the frequently used programs, or just click on All Programs then on the entry Active State Active Python 3.1.

After activating the Python Interactive Shell, we will find a window where you can type our python instructions from the command line. Let’s start with the classic message that programmers use to send to the shell to test its regular operation; I refer to the most classic of messages: “Hello World”.

To display a message from the shell it will be necessary to print it, and then what could be the command that allows us to do this if not print (which translates into Italian means printing), this confirming the fact that reading the Python code is equivalent to reading a common listing in English.

Then to display the message “Hello World” at the command prompt, just type the following statement:

print ('Hello World')

to obtain the printout of the message as shown in the figure.

python prompt

Having done this, let’s see now how to receive a first and immediate help from the Python interactive shell; in fact, when the shell opens, the following message is displayed:

Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.

>>>

USEFUL LINKS FOR THE TOPIC:

Python software

Let’s first see where to find the Python software to install on our machine in order to start programming with Python. The packages that we will have to install are available on the official website of the language at the following url:

http://www.python.org/

Naturally, before downloading the software versions, we will have to inform ourselves about the type of machine at our disposal and the operating system installed on it. However, remember that Python is available for practically all operating systems in circulation.

The Python interpreter will allow the translation of our Python code into a language that our computer can understand and that will allow it to execute the instructions contained in it. In the writing period of this book, the current version of the Python interpretation is 3.1.2 which represents the stable one and that is why in the examples that will accompany us in the following chapters we will refer to that version.

We can safely download the Python software from the network, as the programming with Python is all open source and therefore freely downloadable from the internet where we can find sites that in addition to providing detailed procedures for downloading the current version of the software also provide satisfactory documentation.