Tutorial by Examples

If the help function is called in the console without any arguments, Python presents an interactive help console, where you can find out about Python modules, symbols, keywords and more. >>> help() Welcome to Python 3.4's help utility! If this is your first time using Python, you sho...
To get the value of the last result from your last expression in the console, use an underscore _. >>> 2 + 2 4 >>> _ 4 >>> _ + 6 10 This magic underscore value is only updated when using a python expression that results in a value. Defining functions or for loops ...
The console for the primary version of Python can usually be opened by typing py into your windows console or python on other platforms. $ py Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits&...
You can set an environment variable called PYTHONSTARTUP for Python's console. Whenever you enter the Python console, this file will be executed, allowing for you to add extra functionality to the console such as importing commonly-used modules automatically. If the PYTHONSTARTUP variable was set t...
Python has a variety of command-line switches which can be passed to py. These can be found by performing py --help, which gives this output on Python 3.4: Python Launcher usage: py [ launcher-arguments ] [ python-arguments ] script [ script-arguments ] Launcher arguments: -2 : Launch ...
The Python console adds a new function, help, which can be used to get information about a function or object. For a function, help prints its signature (arguments) and its docstring, if the function has one. >>> help(print) Help on built-in function print in module builtins: print(.....

Page 1 of 1