From d4a877adb7e443d86d52179722a5edec62f15ba1 Mon Sep 17 00:00:00 2001 From: Randy8080 Date: Fri, 4 Jun 2021 17:20:40 +0800 Subject: [PATCH] Updated python.md --- python.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python.md b/python.md index 0a0f262..a0d7d7d 100644 --- a/python.md +++ b/python.md @@ -1059,8 +1059,8 @@ class ChildClass(ParentClass): obj_A = ParentClass() obj_B = ChildClass() -obj_A.print_self() # A -obj_B.print_self() # B +obj_A.print_self() # => A +obj_B.print_self() # => B ``` ### Overriding @@ -1089,9 +1089,9 @@ class Dog(Animal): print("Woof!") Yoki = Dog("Yoki", 4) -print(Yoki.name) # YOKI -print(Yoki.legs) # 4 -Yoki.sound() # Woof! +print(Yoki.name) # => YOKI +print(Yoki.legs) # => 4 +Yoki.sound() # => Woof! ``` @@ -1150,6 +1150,6 @@ except (TypeError, NameError): pass # Multiple exceptions can be handled together, if required. else: # Optional clause to the try/except block. Must follow all except blocks print("All good!") # Runs only if the code in try raises no exceptions -finally: # Execute under all circumstances +finally: # Execute under all circumstances print("We can clean up resources here") ```