From 575cf064afaff9f8fa8db028e22264143e881e93 Mon Sep 17 00:00:00 2001
From: Ken Nguyen <30739815+kennguyen01@users.noreply.github.com>
Date: Sat, 3 Nov 2018 13:20:23 -0400
Subject: [PATCH] Updated code examples to Python 3 (#20765)
---
.../exception-and-error-handling/index.md | 34 ++++++++++---------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/guide/english/python/exception-and-error-handling/index.md b/guide/english/python/exception-and-error-handling/index.md
index ceedeb1eb8..8877667fcd 100644
--- a/guide/english/python/exception-and-error-handling/index.md
+++ b/guide/english/python/exception-and-error-handling/index.md
@@ -10,24 +10,26 @@ To solve this problem in python we can use `try` and `except`
Example:
-```shell
->>> try:
->>> . . . print "this is not a string "+1
->>> except:
->>> . . . print "error"
-error
-```
-and if you want to get error messages in more detail from your code, you can add arguments `except Exception as err`
+```python
+try:
+ print("this is not a string " + 1)
+except:
+ print("error")
-```shell
->>> try:
->>> . . . print "this is not a string "+1
->>> except Exception as err:
->>> . . . print "error:\n"+str(err)
-error:
-cannot concatenate 'str' and 'int' objects
+>>> error
+```
+And if you want to get error messages in more detail from your code, you can add arguments `except Exception as err`
+
+```python
+try:
+ print("this is not a string " + 1)
+except Exception as err:
+ print("error:\n" + str(err))
+
+>>> error:
+>>> must be str, not int
```
More Information:
-Errors and Exceptions documentation.
+Errors and Exceptions documentation.