Advanced Python Topics: Exceptions & Command Line Arguments

Python    |    Beginner
  • 11 videos | 1h 12m 19s
  • Includes Assessment
  • Earns a Badge
Rating 4.5 of 196 users Rating 4.5 of 196 users (196)
In this 11-video course, learners can examine different types of exceptions that can be raised in Python and how they can be handled with except blocks. Explore execution of Python scripts from the command line, including use and parsing of command-line arguments. To begin, use a try and except block to handle a Python exception, then learn how to handle exceptions that your code may raise. Explore how exceptions are defined in a hierarchy and how related exceptions are caught and handled. Next, define multiple except blocks to handle various exceptions that can be raised by code; convert code prototyped in a Jupyter notebook into a Python script that can be executed from a shell, and run code from the Python shell and execute single-line and multi-line commands. Learn about parsing command line arguments, and use the sys and argparse module to access command-line arguments to a Python script, then parse and use the arguments passed to a Python script from the command line. Finally, learn to define command-line arguments by using argparse.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Use a try and except block to handle a python exception
    Control how you handle exceptions that your code may raise
    Recognize how exceptions are defined in a hierarchy and how related exceptions can be caught and handled
    Define multiple except blocks to handle various exceptions that can be raised by your code
    Convert code prototyped in a jupyter notebook into a python script that can be executed from a shell
  • Run your code from the python shell and recognize how to execute single-line and multi-line commands
    Use the sys and argparse module to access command line arguments to a python script
    Parse and use the arguments passed to a python script from the command line
    Define the names and other customizable features of command line arguments to a python script using the argparse module
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 8s
  • 7m 20s
    In this video, learn how to use a try/except block to handle a Python exception. FREE ACCESS
  • Locked
    3.  Defining Custom Exception Handlers
    5m 57s
    In this video, you will learn how to handle exceptions that your code may raise. FREE ACCESS
  • Locked
    4.  The Exception Hierarchy
    7m 51s
    After completing this video, you will be able to recognize how exceptions are defined in a hierarchy and how related exceptions can be caught and handled. FREE ACCESS
  • Locked
    5.  Chaining except Blocks
    9m 15s
    In this video, you will define multiple except blocks to handle various exceptions that can be raised by your code. FREE ACCESS
  • Locked
    6.  Going from Jupyter Notebooks to Python Scripts
    7m 30s
    In this video, you will learn how to go from Jupyter Notebooks to Python Scripts. You will also discover the main factors involved when building your prototype in Jupyter notebooks and later deploying them as Python source files. FREE ACCESS
  • Locked
    7.  Using the Python Shell
    9m 20s
    In this video, you will learn how to use the Python Shell. You will also discover how to bring up a shell environment on your own system. FREE ACCESS
  • Locked
    8.  An Introduction to Parsing Command Line Arguments
    9m 2s
    In this video, you will learn how to parse command line arguments in a Python script. FREE ACCESS
  • Locked
    9.  Using Command Line Arguments in a Script
    4m 57s
    In this video, you will learn how to access the command line arguments which have been passed to a Python script. FREE ACCESS
  • Locked
    10.  Define Command-Line Arguments using argparse
    7m 36s
    In this video, you will learn how to define command-line arguments using argparse. You will also discover how to include documentation with regards to an argument. FREE ACCESS
  • Locked
    11.  Course Summary
    1m 24s

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 226 users Rating 4.5 of 226 users (226)
Rating 4.3 of 111 users Rating 4.3 of 111 users (111)
Rating 4.5 of 228 users Rating 4.5 of 228 users (228)