appunti3s:eccezioni_in_python
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
appunti3s:eccezioni_in_python [2020/08/01 11:54] – [Prima delle eccezioni] profpro | appunti3s:eccezioni_in_python [2020/08/01 11:55] – [Prima delle eccezioni] profpro | ||
---|---|---|---|
Line 21: | Line 21: | ||
* Mescolare dati di tipo diverso | * Mescolare dati di tipo diverso | ||
+ | ===Esempio errrato=== | ||
< | < | ||
>>> | >>> | ||
Line 26: | Line 27: | ||
File "< | File "< | ||
IOError: [Errno 2] No such file or directory: ' | IOError: [Errno 2] No such file or directory: ' | ||
+ | </ | ||
+ | |||
+ | ===Esempio corretto=== | ||
+ | < | ||
>>> | >>> | ||
- | ... var = open("/notthere") | + | ... var = open("non-esiste.txt") |
... except IOError: | ... except IOError: | ||
... print "il file non esiste, ma rimaniamo calmi e gestiamo il problema" | ... print "il file non esiste, ma rimaniamo calmi e gestiamo il problema" | ||
... print " | ... print " | ||
</ | </ |
appunti3s/eccezioni_in_python.txt · Last modified: 2020/08/01 12:06 by profpro