What is "finally:" for?

Andreas Kaiser kaiser.vocote at gmail.com
Tue Sep 16 13:30:41 CEST 2008


On 16 Sep., 13:25, "Max Ivanov" <ivanov.ma... at gmail.com> wrote:
> Hi all!
> When and where I should use try-except-finally statement? What is the
> difference between:
> --------
> try:
>   A...
> except:
>   B....
> finally:
>   C...
> --------
It does A if no exception or B if an exception occurs. THEN it does
always C.
>
> and
> -------
> try:
>   A...
> except:
>   B....
> C...
If an exception occurs, C is never reaching.

Andreas



More information about the Python-list mailing list