martedì 22 ottobre 2013

Come consultare l'help in Python



help in Python
help in Python

Spesso quando ci mettiamo al lavoro per scrivere un programma potremo avvertire l'esigenza di consultare la documentazione a corredo del software per ottenere utili informazioni. Questa operazione in Python può essere effettuata consultando l'help che la shell interativa ci mette a disposizione, vediamo allora come fare.  

Per ricevere un primo ed immediato aiuto proprio dalla shell interattiva di python, possiamo notare che all’apertura della shell viene visualizzato il seguente messaggio:

ActivePython 3.1.2.3 (ActiveState Software Inc.) based on

Python 3.1.2 (r312:79147, Mar 22 2010, 12:30:45) [MSC v.1500 64 bit (AMD64)] on

win32

Type "help", "copyright", "credits" or "license" for more information.

>>> 

che ci invita appunto a digitare il comando help() per ricevere informazioni sull'uso dell'interprete python. 

Dopo aver impartito il comando si riceve un messaggio di benvenuto dalla funzione di Guida in linea che ci invita nel caso fossimo dei principianti a consultare il tutorial disponibile su Internet all'url http://docs.python.org/tutorial/ :

>>> help()



Welcome to Python 3.1!  This is the online 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/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, or topics, type "modules", "keywords", or "topics".  Each module also comes with a one-line summary of what it does; to list the modules whose summaries contain a given word such as "spam", type "modules spam".



help>

Nella guida in linea disponibile in Python, che come già abbiamo avuto modo di dire è attivabile con il seguente comando:

>>> help()

basterà inserire il nome di qualsiasi modulo, parola chiave o un argomento per ottenere aiuto sulla scrittura redazione di programmi Python. 

Per uscire poi dalla guida in linea per fare ritorno all'interprete, è sufficiente digitare "quit". Per ottenere invece un elenco dei moduli disponibili, delle parole chiave previste o degli argomenti utilizzabili, sarà necessario digitare "modules","keywords", oppure "topics".  

PER APPROFONDIRE L’ARGOMENTO CLICCARE SUL LINK SEGUENTE:






python
Risorse online:

Nessun commento:

Posta un commento