28.10.2021 Views

Python Tutorial ( PDFDrive )

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The except clause with no exceptions: .................................................. 305

The except clause with multiple exceptions: .......................................... 305

The try-finally clause: ............................................................................. 305

EXAMPLE: ........................................................................................... 305

Argument of an Exception: ..................................................................... 306

EXAMPLE: ............................................................................................. 306

Raising an exceptions: ........................................................................... 307

TUTORIALS POINT

Simply Easy Learning

SYNTAX: .............................................................................................. 307

EXAMPLE: ........................................................................................... 307

User-Defined Exceptions: ...................................................................... 307

Python Classes/Objects ........................................................ 309

Overview of OOP Terminology .............................................................. 309

Creating Classes: ................................................................................... 309

EXAMPLE: ........................................................................................... 310

Creating instance objects: ...................................................................... 310

Accessing attributes: .............................................................................. 310

Built-In Class Attributes: ......................................................................... 311

Destroying Objects (Garbage Collection): .............................................. 312

EXAMPLE: ........................................................................................... 312

Class Inheritance: .................................................................................. 313

SYNTAX: ................................................................................................ 313

EXAMPLE: ............................................................................................. 313

Overriding Methods: ............................................................................... 314

EXAMPLE: ........................................................................................... 314

Base Overloading Methods: ................................................................... 315

Overloading Operators: .......................................................................... 315

EXAMPLE: ........................................................................................... 315

Data Hiding: ........................................................................................... 316

EXAMPLE: ........................................................................................... 316

Python Regular Expressions ................................................. 317

The match Function ............................................................................... 317

EXAMPLE: ........................................................................................... 318

The search Function .............................................................................. 318

EXAMPLE: ........................................................................................... 319

Matching vs Searching: .......................................................................... 319

EXAMPLE: ........................................................................................... 319

Search and Replace: .............................................................................. 319

SYNTAX: .............................................................................................. 320

EXAMPLE: ........................................................................................... 320

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!