Manejo de errores en Python

I'm writing a small parser class for a personal project. The class will essentially parse popular playlist files and return useful information.

Since the class will interact with files, I'm not sure about the best way to handle errors. I'm a Linux guy and generally do things in errno fashion but I'm wondering that whether exceptions are a better selection or not.

In short what's the best way to handle these things in python world?

Gracias de antemano.

preguntado el 08 de noviembre de 11 a las 13:11

with and exceptions.. -

There are some file i/o related examples in the python docs on handling exceptions -

Echa un vistazo a este ejemplo from Dive Into Python. -

1 Respuestas

You want to use exceptions. And if you are using python 2.7, you want to use the with ambiental.

Hay un buen tutorial in the standard python documentation , but there are tons of other recources: wikilibros, sumergirse en python, articles in blogs.

respondido 08 nov., 11:19

Thanks, that answers my question pretty much. - Bayindirh

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.