Python: Errores y Excepciones

📰 Medium · Python

Learn to handle errors and exceptions in Python to improve code quality and debugging skills

beginner Published 20 Apr 2026
Action Steps
  1. Identify syntax errors using Python's built-in error messages
  2. Use try-except blocks to catch and handle exceptions
  3. Analyze error types such as IndentationError and SyntaxError to correct code mistakes
  4. Apply error handling techniques to improve code readability and reliability
  5. Practice debugging code using Python's interactive shell or a debugger
Who Needs to Know This

Python developers and beginners can benefit from understanding error handling to write more robust code and collaborate effectively on projects

Key Insight

💡 Python's error handling mechanisms help developers identify and fix code mistakes efficiently

Share This
Improve your #Python skills by learning to handle errors and exceptions! #debugging #coding

Key Takeaways

Learn to handle errors and exceptions in Python to improve code quality and debugging skills

Full Article

Title: Python: Errores y Excepciones

URL Source: https://medium.com/@denebtech/python-errores-y-excepciones-2ccb85da2ffd?source=rss------python-5

Published Time: 2026-04-20T10:01:01Z

Markdown Content:
# Python: Errores y Excepciones. Nuevo día, nueva entrega. Es común… | by denebtech | Apr, 2026 | Medium

[Sitemap](https://medium.com/sitemap/sitemap.xml)

[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40denebtech%2Fpython-errores-y-excepciones-2ccb85da2ffd&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)

Get app

[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)

[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40denebtech%2Fpython-errores-y-excepciones-2ccb85da2ffd&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

![Image 1](https://miro.medium.com/v2/resize:fill:64:64/1*dmbNkD5D-u45r44go_cf0g.png)

Press enter or click to view image in full size

![Image 2](https://medium.com/@denebtech/python-errores-y-excepciones-2ccb85da2ffd?source=rss------python-5)

# Python: Errores y Excepciones

[![Image 3: denebtech](https://miro.medium.com/v2/resize:fill:64:64/1*e299ITDfm3Bg6UuVM0P1oA.jpeg)](https://medium.com/@denebtech?source=post_page---byline--2ccb85da2ffd---------------------------------------)

[denebtech](https://medium.com/@denebtech?source=post_page---byline--2ccb85da2ffd---------------------------------------)

3 min read

·

Just now

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F2ccb85da2ffd&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40denebtech%2Fpython-errores-y-excepciones-2ccb85da2ffd&user=denebtech&userId=7bb3036ba67a&source=---header_actions--2ccb85da2ffd---------------------clap_footer------------------)

--

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F2ccb85da2ffd&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40denebtech%2Fpython-errores-y-excepciones-2ccb85da2ffd&source=---header_actions--2ccb85da2ffd---------------------bookmark_footer------------------)

Share

Nuevo día, nueva entrega. Es común cometer errores al escribir código; por ello, Python genera errores y excepciones que nos ayudan a determinar exactamente dónde nos hemos equivocado.

### Errores de sintaxis

Los lenguajes de programación poseen reglas específicas para la escritura de código, como exploramos en nuestra primera publicación sobre la [**sintaxis de Python**](https://medium.com/@denebtech/python-syntax-c521325566b4). Cuando el intérprete detecta una sentencia que no cumple con estas normas, se produce un **error de sintaxis**.

En general, Python nos indica en qué parte del código se produjo el error para facilitar la búsqueda y corregirlo con rapidez. En el siguiente fragmento de código, podemos ver un IndentationError en la función `print()`.

>>> if True:

... print("error")

File "<stdin>", line 2

print("error")

^

IndentationError: expected an indented block
Analicemos el siguiente fragmento:

>>> if True print("error")

File "<stdin>", line 1

if True print("error")

^

SyntaxError: invalid syntax

>>>

>>>

>>> if True: print("error")

...

error
En el primer ejemplo, Python detecta un **SyntaxError** debido a la omisión de los dos puntos (`:`) antes de la función `print()`. En el segundo, obse
Read full article → ← Back to Reads