The Python Tutorial — Python 3.15.2 documentation
It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well. For a ...
It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well. For a ...
The specification, background, and examples for the Python with statement.The returned value is bound to the function name instead of the function object. Multiple decorators are applied in nested fashion. For example, the following code.
In the following examples, input and output are distinguished by the presence or absence of prompts (>>> and …): to repeat the example, you must type ...
In a while loop, it’s executed after the loop’s condition becomes false. In either kind of loop, the else clause is not executed if the loop was terminated by a break. Of course, other ways of ending the loop early, such as a return or a raised exception, will also skip execution of the else clause.
... Python Initialization providing finer control on the whole configuration and better error reporting. ... while code that handles errors from os.readlink() may now ...
Source code: Lib/asyncio/events.py, Lib/asyncio/base_events.py Preface The event loop is the core of every asyncio application.Server objects. Event loop implementations. Examples. Hello World with call_soon(). Display the current date with call_later().
Dec 12, 2010 ... This is so that errors which occur while handling logging events ... You can write code like this: Copy if logger.isEnabledFor(logging ...
Source code: Lib/pdb.py The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and ...
Roughly equivalent to nested for-loops in a generator expression. For example, product(A, B) returns the same as ((x,y) for x in A for y in B). The nested loops cycle like an odometer with the rightmost element advancing on every iteration.
The list of command line arguments passed to a Python script. argv[0] is the script name (it is operating system dependent whether this is a full pathname or ...
Source code: Lib/turtle.py Turtle star: Turtle can draw intricate shapes using programs that repeat simple moves. A yellow starburst of thin spikes with a ...