Understanding the main() function

Let's start by examining the main() function, which is called on line 90, as seen in the previous code block. This function, on line 42, requires the vid and pid information supplied by the user's arguments for resolution in the usb.ids database. On lines 43 through 46, we create our initial variables. The url variable stores the URL containing the USB data source. We use the urlopen() function from the urllib module to create a list of strings from our online source. We will use a lot of string operations, such as startswith(), isalnum(), islower(), and count(), to parse the usb.ids file structure and store the parsed data in the usbs dictionary. The curr_id variable, defined as an empty string on line

Get Learning Python for Forensics - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.