title
Google Python Class Day 2 Part 3

description
Google Python Class Day 2 Part 3: Utilities: URLs and HTTP, Exceptions. By Nick Parlante. Support materials and exercises: http://code.google.com/edu/languages/google-python-class

detail
{'title': 'Google Python Class Day 2 Part 3', 'heatmap': [{'end': 1041.223, 'start': 1004.008, 'weight': 0.812}], 'summary': 'Covers finding python modules, file handling, exceptions, dynamic exception handling, python fundamentals, and url parsing with apache log file processing, emphasizing practical demonstrations and emphasizing the importance of reusability and functionality of well-designed functions and modules within big software systems.', 'chapters': [{'end': 108.72, 'segs': [{'end': 79.123, 'src': 'embed', 'start': 32.049, 'weight': 0, 'content': [{'end': 44.178, 'text': "So I'm about to show you the URL lib module and I suspect, If you do a Google search for Python URL library or Python URL module,", 'start': 32.049, 'duration': 12.129}, {'end': 46.22, 'text': 'in my experience the hits are pretty good.', 'start': 44.178, 'duration': 2.042}, {'end': 47.761, 'text': "So that's the freeform answer.", 'start': 46.82, 'duration': 0.941}, {'end': 53.866, 'text': 'The other answer is that Python.org is the official, maintained standard.', 'start': 48.001, 'duration': 5.865}, {'end': 56.828, 'text': "It's very browsable, and there's a lot of organizational modules there.", 'start': 54.607, 'duration': 2.221}, {'end': 58.21, 'text': 'So I think those are two pretty good answers.', 'start': 56.849, 'duration': 1.361}, {'end': 60.532, 'text': 'But here is the problem.', 'start': 58.53, 'duration': 2.002}, {'end': 61.953, 'text': 'You search on their OS.', 'start': 60.572, 'duration': 1.381}, {'end': 69.437, 'text': "and they don't show you that there is OS.path in there that you should actually be looking at, you get like Yeah, I agree.", 'start': 62.512, 'duration': 6.925}, {'end': 75.541, 'text': "So the comment is, if you just do DIR on OS, it's hard to know that you need to look in OS.path, especially because So I agree.", 'start': 69.457, 'duration': 6.084}, {'end': 79.123, 'text': "So I think DIR, it's kind of a nice quick and dirty solution.", 'start': 75.561, 'duration': 3.562}], 'summary': 'Python url library has good hits, python.org is official standard with many modules. dir is quick solution.', 'duration': 47.074, 'max_score': 32.049, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og32049.jpg'}], 'start': 0.273, 'title': 'Finding python modules', 'summary': 'Discusses the challenges of finding information about python modules, emphasizing the use of google search and python.org for browsing, while highlighting the limitations of using dir command to find specific modules.', 'chapters': [{'end': 108.72, 'start': 0.273, 'title': 'Finding python modules', 'summary': 'Discusses the challenges of finding information about python modules, emphasizing the use of google search and python.org for browsing, while highlighting the limitations of using dir command to find specific modules.', 'duration': 108.447, 'highlights': ['The chapter emphasizes the use of Google search and python.org for finding information about Python modules, highlighting their effectiveness in providing relevant hits and browsing experience.', 'It points out the limitations of using the DIR command to find specific modules, highlighting its inadequacy in revealing the necessary module like OS.path, and suggests using more comprehensive methods for better results.']}], 'duration': 108.447, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og273.jpg', 'highlights': ['The chapter emphasizes the use of Google search and python.org for finding information about Python modules, highlighting their effectiveness in providing relevant hits and browsing experience.', 'It points out the limitations of using the DIR command to find specific modules, highlighting its inadequacy in revealing the necessary module like OS.path, and suggests using more comprehensive methods for better results.']}, {'end': 369.82, 'segs': [{'end': 191.071, 'src': 'embed', 'start': 155.429, 'weight': 0, 'content': [{'end': 157.411, 'text': 'And so I want to spend a few minutes just mentioning how this works.', 'start': 155.429, 'duration': 1.982}, {'end': 167.376, 'text': "So what this code does is here's this function called cat, and it takes a file name argument and all it does.", 'start': 159.014, 'duration': 8.362}, {'end': 167.916, 'text': 'is it just?', 'start': 167.376, 'duration': 0.54}, {'end': 171.857, 'text': 'you know, it tries to read it and then it prints out.', 'start': 167.916, 'duration': 3.941}, {'end': 175.257, 'text': 'here I had it print like dash, dash dash on the file name and then it prints the text from the file.', 'start': 171.857, 'duration': 3.4}, {'end': 179.778, 'text': 'And then down here at the main, very much like the mains you guys have.', 'start': 175.717, 'duration': 4.061}, {'end': 183.039, 'text': 'it just takes any number of command line arguments and it just tries to cat all of them.', 'start': 179.778, 'duration': 3.261}, {'end': 191.071, 'text': "So I guess I'll go with my two, I'll leave that text up there and go to the other one.", 'start': 184.159, 'duration': 6.912}], 'summary': "A function 'cat' reads and prints file content, main function reads command line arguments to call 'cat'.", 'duration': 35.642, 'max_score': 155.429, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og155429.jpg'}, {'end': 307.454, 'src': 'embed', 'start': 282.061, 'weight': 2, 'content': [{'end': 288.063, 'text': "Now, the mechanism, I'm going to get into just a little bit of detail here, that's going on here is called an exception.", 'start': 282.061, 'duration': 6.002}, {'end': 297.786, 'text': "What's happened is that this line F equals open a file name is said to have thrown an exception object representing a runtime failure like okay,", 'start': 288.783, 'duration': 9.003}, {'end': 298.586, 'text': 'this is not going to work.', 'start': 297.786, 'duration': 0.8}, {'end': 305.132, 'text': 'and the default behavior of an exception is that it goes all the way out to main and exits the program.', 'start': 299.446, 'duration': 5.686}, {'end': 307.454, 'text': "It just unwinds the whole thing and like, okay, we're done.", 'start': 305.452, 'duration': 2.002}], 'summary': 'Explanation of exception mechanism in programming.', 'duration': 25.393, 'max_score': 282.061, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og282061.jpg'}, {'end': 369.82, 'src': 'embed', 'start': 340.858, 'weight': 3, 'content': [{'end': 342.899, 'text': "I'm just showing you the most simple thing possible.", 'start': 340.858, 'duration': 2.041}, {'end': 345.701, 'text': "So the way to do this is I'm going to say try.", 'start': 343.74, 'duration': 1.961}, {'end': 350.491, 'text': "And so that's a little, this is called a try block.", 'start': 348.41, 'duration': 2.081}, {'end': 352.312, 'text': "And then I'll say except.", 'start': 350.531, 'duration': 1.781}, {'end': 354.973, 'text': "And then I'm going to say IO error.", 'start': 353.152, 'duration': 1.821}, {'end': 360.996, 'text': 'So if I go back over here, the exception that was thrown to here is an IO error.', 'start': 355.013, 'duration': 5.983}, {'end': 362.377, 'text': "So I'm going to catch that.", 'start': 361.016, 'duration': 1.361}, {'end': 364.217, 'text': 'IO error.', 'start': 363.717, 'duration': 0.5}, {'end': 369.82, 'text': "And I'll say print, you know, something.", 'start': 365.818, 'duration': 4.002}], 'summary': 'Demonstrating try-except block to catch io error and print.', 'duration': 28.962, 'max_score': 340.858, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og340858.jpg'}], 'start': 109.9, 'title': 'Python file handling and exceptions', 'summary': "Covers file handling and exceptions in python, demonstrating a custom 'cat' utility function, and handling command line arguments, allowing users to print the contents of specified files with a focus on runtime errors and io error in the context of file handling.", 'chapters': [{'end': 216.482, 'start': 109.9, 'title': 'Python file handling and exceptions', 'summary': "Covers file handling and exceptions in python, demonstrating a custom 'cat' utility function and how it handles command line arguments, allowing users to print the contents of specified files.", 'duration': 106.582, 'highlights': ["The 'cat' function takes a file name argument, attempts to read it, and then prints the text from the file, showcasing file handling in Python.", "The main function handles command line arguments to execute the 'cat' function for multiple files, illustrating the practical use of file handling in Python.", 'The chapter briefly touches upon exceptions in Python, emphasizing that it is useful to have a basic understanding of them, despite not being necessary for the exercise.', "The demonstration includes running the 'hello' script, using it to print the contents of specified files, and showcasing the functionality of the custom 'cat' utility function."]}, {'end': 369.82, 'start': 217.623, 'title': 'Handling runtime errors', 'summary': 'Covers the handling of runtime errors, including the use of exceptions to intercept errors, print error messages, and continue program execution, with a focus on the io error in the context of file handling.', 'duration': 152.197, 'highlights': ['The chapter explains the concept of exceptions as a mechanism to represent runtime failures and how the default behavior of an exception is to exit the program. Default behavior of an exception is to exit the program.', 'It highlights the use of try and except blocks to catch specific exceptions, such as the IO error, and print error messages to enable the program to continue execution despite errors. Demonstrates the use of try and except blocks to catch specific exceptions and print error messages.', 'The chapter emphasizes the need to handle errors in a way that allows the program to continue execution and provides a simple example of catching the IO error to achieve this. Emphasizes the need to handle errors to allow program continuation.']}], 'duration': 259.92, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og109900.jpg', 'highlights': ["The main function handles command line arguments to execute the 'cat' function for multiple files, illustrating the practical use of file handling in Python.", "The 'cat' function takes a file name argument, attempts to read it, and then prints the text from the file, showcasing file handling in Python.", 'The chapter explains the concept of exceptions as a mechanism to represent runtime failures and how the default behavior of an exception is to exit the program.', 'The chapter emphasizes the need to handle errors in a way that allows the program to continue execution and provides a simple example of catching the IO error to achieve this.']}, {'end': 803.79, 'segs': [{'end': 448.579, 'src': 'embed', 'start': 423.903, 'weight': 0, 'content': [{'end': 430.008, 'text': "So, rather than the default kind of kill the whole program behavior, I'm at least scratching the surface of exceptions to kind of control it,", 'start': 423.903, 'duration': 6.105}, {'end': 430.708, 'text': 'print something and keep going.', 'start': 430.008, 'duration': 0.7}, {'end': 431.809, 'text': "All right, so now let's see.", 'start': 431.049, 'duration': 0.76}, {'end': 436.352, 'text': 'And other languages have the same feature.', 'start': 433.07, 'duration': 3.282}, {'end': 438.053, 'text': "It's called exceptions in other languages.", 'start': 436.472, 'duration': 1.581}, {'end': 440.274, 'text': 'Python just has its own syntax for it.', 'start': 438.253, 'duration': 2.021}, {'end': 444.036, 'text': 'So if I do this one, I think that is actually good.', 'start': 440.314, 'duration': 3.722}, {'end': 448.579, 'text': "So there's the first one failing.", 'start': 444.676, 'duration': 3.903}], 'summary': 'Discussion on handling exceptions and syntax in python, with reference to other languages.', 'duration': 24.676, 'max_score': 423.903, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og423903.jpg'}, {'end': 540.183, 'src': 'embed', 'start': 510.793, 'weight': 1, 'content': [{'end': 514.316, 'text': "This code will compile and run fine so long as the exception doesn't happen.", 'start': 510.793, 'duration': 3.523}, {'end': 515.857, 'text': "This is kind of what you're saying.", 'start': 514.336, 'duration': 1.521}, {'end': 520.561, 'text': 'So to sort of distill this, when you load a Python file, pretty much nothing is checked.', 'start': 515.876, 'duration': 4.685}, {'end': 525.566, 'text': 'Errors, you know, typos of variable names, functions wrong, just totally errors are not checked.', 'start': 521.022, 'duration': 4.544}, {'end': 529.149, 'text': "It is only when the code actually executes over those lines, that's when it's checked.", 'start': 525.966, 'duration': 3.183}, {'end': 531.731, 'text': "And that, you know, I'm sure you've noticed that for the last couple of days.", 'start': 529.189, 'duration': 2.542}, {'end': 531.971, 'text': 'All right.', 'start': 531.751, 'duration': 0.22}, {'end': 534.64, 'text': 'the main theme here.', 'start': 534.2, 'duration': 0.44}, {'end': 537.102, 'text': "All right, so that's just, exceptions is a deep topic.", 'start': 534.66, 'duration': 2.442}, {'end': 540.183, 'text': 'I just felt like I should show you just six minutes worth, just a little bit of how they work.', 'start': 537.142, 'duration': 3.041}], 'summary': 'Python file loading does not check errors; exceptions are checked during execution.', 'duration': 29.39, 'max_score': 510.793, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og510793.jpg'}, {'end': 664.63, 'src': 'embed', 'start': 636.784, 'weight': 2, 'content': [{'end': 639.087, 'text': "We've been doing sort of primitive command line parsing.", 'start': 636.784, 'duration': 2.303}, {'end': 640.769, 'text': 'I would just sort of do it by hand.', 'start': 639.127, 'duration': 1.642}, {'end': 642.191, 'text': "That's fine for simple things.", 'start': 641.21, 'duration': 0.981}, {'end': 644.454, 'text': 'There also are command line flag parsing libraries.', 'start': 642.471, 'duration': 1.983}, {'end': 647.918, 'text': 'You can go find the module for it if you wanted more rich flag support.', 'start': 644.854, 'duration': 3.064}, {'end': 652.604, 'text': "So that's a very basic thing to get right, but certainly step one for modularity, you would want to get that right.", 'start': 648.259, 'duration': 4.345}, {'end': 658.988, 'text': "The next layer up would be if you want to reuse someone else's module.", 'start': 653.785, 'duration': 5.203}, {'end': 664.63, 'text': 'And instead of calling their program as like a program and passing it flags, you really want to call their Python function.', 'start': 659.488, 'duration': 5.142}], 'summary': 'Using command line flag parsing libraries for modularity and python function reuse.', 'duration': 27.846, 'max_score': 636.784, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og636784.jpg'}], 'start': 369.86, 'title': 'Python exception handling', 'summary': 'Explains dynamic exception handling in python, illustrating the concept using a file handling scenario, and explores how exceptions can control program behavior, print error messages, and address modularity through the use of command line flags and module reuse.', 'chapters': [{'end': 405.828, 'start': 369.86, 'title': 'Dynamic exception handling in python', 'summary': 'Explains the dynamic behavior of try-except blocks in python, where it can interrupt the usual linear execution flow and jump to a specific exception handling block based on the runtime error, illustrating the concept using a file handling scenario.', 'duration': 35.968, 'highlights': ['The try-except block in Python allows for dynamic error handling, where if any line within the try block encounters an error at runtime, it interrupts the linear execution flow and jumps to the corresponding except block.', 'The interruption in the code flow occurs when an error is encountered at runtime, demonstrating the dynamic behavior of the try-except block.', 'The explanation uses a file handling scenario to illustrate the dynamic nature of the try-except block in Python.']}, {'end': 803.79, 'start': 406.488, 'title': 'Python exceptions and modularity', 'summary': 'Explores the concept of exceptions in python, demonstrating how they can control program behavior and print error messages, and touches on the modularity of code, emphasizing the use of command line flags and the reuse of modules.', 'duration': 397.302, 'highlights': ['Python exceptions demonstrate controlling program behavior and printing error messages The speaker shows how exceptions can be used to control program behavior, such as printing an error message and continuing the program, rather than terminating it. For example, an IO error is caught and the loop continues, demonstrating the use of exceptions to handle errors and continue program execution.', "Python's treatment of errors and variable names during execution instead of compilation The discussion highlights Python's behavior of superficially reading code during module loading and deferring semantic analysis to execution, which can result in unknown variable errors only during code execution rather than compilation. The speaker emphasizes that Python does not check for errors, variable name typos, or undefined functions during module loading, but only during code execution.", 'Emphasis on modularity and code reuse through command line flags and module integration The speaker discusses the importance of modularity in code, particularly focusing on code reuse through the use of command line flags to feed input and specifying output and the integration of reusable modules by calling their functions instead of their programs.']}], 'duration': 433.93, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og369860.jpg', 'highlights': ['The explanation uses a file handling scenario to illustrate the dynamic nature of the try-except block in Python.', "Python's treatment of errors and variable names during execution instead of compilation.", 'Emphasis on modularity and code reuse through command line flags and module integration.']}, {'end': 1104.114, 'segs': [{'end': 907.921, 'src': 'embed', 'start': 862.982, 'weight': 0, 'content': [{'end': 868.064, 'text': "So what's happening is it understands, well, this big string that's the first line, that's probably the documentation for this function.", 'start': 862.982, 'duration': 5.082}, {'end': 870.825, 'text': "So when you call help, that's how help works.", 'start': 868.404, 'duration': 2.421}, {'end': 876.907, 'text': "It's this really trivial system, but that's how it's pulling up little bits of docs of what this function does.", 'start': 870.865, 'duration': 6.042}, {'end': 879.969, 'text': "So now where's my Python interpreter? This one.", 'start': 877.528, 'duration': 2.441}, {'end': 884.689, 'text': "All right, so here I am in Python, and I've imported baby names.", 'start': 881.527, 'duration': 3.162}, {'end': 894.294, 'text': 'So now what I want to show you is I can call, what was it called, extract names? I can call extract names here from the Python interpreter.', 'start': 885.349, 'duration': 8.945}, {'end': 903.219, 'text': "So I could say babynames.extractnames, and what does it take? A name of baby, it's going to be like slash baby1990.html.", 'start': 895.114, 'duration': 8.105}, {'end': 907.921, 'text': "Of course, I think that's right, so let's just try it.", 'start': 903.279, 'duration': 4.642}], 'summary': 'Demo of using python interpreter to call extract names from babynames, with example of input.', 'duration': 44.939, 'max_score': 862.982, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og862982.jpg'}, {'end': 965.535, 'src': 'embed', 'start': 932.828, 'weight': 4, 'content': [{'end': 936.49, 'text': 'I can sort of pluck it out of this program and reuse it for who knows what, some other purpose.', 'start': 932.828, 'duration': 3.662}, {'end': 939.751, 'text': 'So, obviously this is a deep topic,', 'start': 937.851, 'duration': 1.9}, {'end': 944.974, 'text': "but I'm kind of pointing you in the right direction a little bit of what it would mean to have kind of a well-designed program,", 'start': 939.751, 'duration': 5.223}, {'end': 950.476, 'text': 'well-designed function and how modules could share code to build sort of bigger systems.', 'start': 944.974, 'duration': 5.502}, {'end': 952.377, 'text': "And that's what big software systems look like.", 'start': 950.496, 'duration': 1.881}, {'end': 954.609, 'text': 'All right.', 'start': 954.129, 'duration': 0.48}, {'end': 955.77, 'text': 'So let me show you.', 'start': 955.05, 'duration': 0.72}, {'end': 958.771, 'text': "So that's the style discussion for this section.", 'start': 955.79, 'duration': 2.981}, {'end': 965.535, 'text': 'So the other thing I want to show you, I guess I need the Python interpreter back, is I want to show you another module.', 'start': 959.752, 'duration': 5.783}], 'summary': 'The discussion covers reusing code, building well-designed programs and sharing modules to create larger software systems.', 'duration': 32.707, 'max_score': 932.828, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og932828.jpg'}, {'end': 1050.743, 'src': 'heatmap', 'start': 1004.008, 'weight': 5, 'content': [{'end': 1010.414, 'text': "And so when I say urllib.urlopen, it's trying to kind of look like that open command that you've used to open files.", 'start': 1004.008, 'duration': 6.406}, {'end': 1011.716, 'text': 'And it returns.', 'start': 1010.755, 'duration': 0.961}, {'end': 1013.057, 'text': 'I named my variable uf.', 'start': 1011.716, 'duration': 1.341}, {'end': 1013.958, 'text': 'there it returns this thing.', 'start': 1013.057, 'duration': 0.901}, {'end': 1019.523, 'text': "that's kind of like a file object like the f, but really it's pointing over the network to this thing.", 'start': 1013.958, 'duration': 5.565}, {'end': 1022.306, 'text': 'So in particular, I can say uf.read.', 'start': 1019.864, 'duration': 2.442}, {'end': 1031.039, 'text': "And what that's going to do is it does the networking and gets all the data and here it is.", 'start': 1025.696, 'duration': 5.343}, {'end': 1034.881, 'text': "And so I could say, for example, I don't know, regular expressions or something.", 'start': 1031.118, 'duration': 3.763}, {'end': 1035.54, 'text': 'You could do this.', 'start': 1034.901, 'duration': 0.639}, {'end': 1039.083, 'text': 'So URL, it has a lot of features.', 'start': 1037.002, 'duration': 2.081}, {'end': 1041.223, 'text': 'You can set cookies and all this other kind of stuff.', 'start': 1039.123, 'duration': 2.1}, {'end': 1044.546, 'text': "And I'm just doing the most simple sort of URL retrieval here.", 'start': 1041.243, 'duration': 3.303}, {'end': 1050.743, 'text': 'So the other thing I want to show you here Man, look at all this.', 'start': 1045.945, 'duration': 4.798}], 'summary': 'Using urllib to retrieve data from a url, accessing features like cookies and simple retrieval.', 'duration': 46.735, 'max_score': 1004.008, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og1004008.jpg'}], 'start': 804.03, 'title': 'Python fundamentals', 'summary': 'Covers python interpreter, accessing documentation with help function, file structure, main function, and triple quoted string. it also discusses python modules like baby names and url lib, emphasizing reusability and functionality of well-designed functions and modules within big software systems.', 'chapters': [{'end': 879.969, 'start': 804.03, 'title': 'Python baby names and documentation', 'summary': 'Discusses the python interpreter and the usage of help function to access documentation, as well as the structure of python files, including the main function and triple quoted string for documentation.', 'duration': 75.939, 'highlights': ['The chapter explores the usage of the Python interpreter and the help function to access documentation, providing insight into the structure of Python files, including the main function and triple quoted string for documentation.', "The speaker demonstrates the usage of the help function by accessing the documentation for the 'extractnames' function, showcasing the practical application of Python's documentation system.", 'The chapter also delves into the structure of Python files, explaining the presence of underbar, underbar internals and the main function, offering valuable insight into Python file organization and function usage.']}, {'end': 1104.114, 'start': 881.527, 'title': 'Python modules and functions', 'summary': 'Discusses the usage of python modules like baby names and url lib, demonstrating the ability to extract names and retrieve data from urls, emphasizing the reusability and functionality of well-designed functions and modules within big software systems.', 'duration': 222.587, 'highlights': ['The chapter discusses the usage of Python modules like baby names and URL lib, demonstrating the ability to extract names and retrieve data from URLs. Demonstrates the use of Python modules for extracting baby names and retrieving data from URLs, showcasing the practical application of Python modules in data manipulation.', 'Emphasizes the reusability and functionality of well-designed functions and modules within big software systems. Highlights the importance of well-designed functions and modules in facilitating code reusability and functionality within big software systems, showcasing the significance of modular programming.', 'Explains the functionality of URL lib, including the ability to make URLs look like files, retrieve data, and perform downloads. Explains the functionality of URL lib in making URLs look like files, retrieving data, and performing downloads, demonstrating the versatility and practical applications of URL lib in web data manipulation.']}], 'duration': 300.084, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og804030.jpg', 'highlights': ['The chapter explores the usage of the Python interpreter and the help function to access documentation, providing insight into the structure of Python files, including the main function and triple quoted string for documentation.', 'The chapter also delves into the structure of Python files, explaining the presence of underbar, underbar internals and the main function, offering valuable insight into Python file organization and function usage.', "The speaker demonstrates the usage of the help function by accessing the documentation for the 'extractnames' function, showcasing the practical application of Python's documentation system.", 'The chapter discusses the usage of Python modules like baby names and URL lib, demonstrating the ability to extract names and retrieve data from URLs.', 'Emphasizes the reusability and functionality of well-designed functions and modules within big software systems.', 'Explains the functionality of URL lib, including the ability to make URLs look like files, retrieve data, and perform downloads.']}, {'end': 1541.178, 'segs': [{'end': 1132.365, 'src': 'embed', 'start': 1105.415, 'weight': 0, 'content': [{'end': 1109.578, 'text': 'So now if I control Z out of here, if I do an LS, check it out.', 'start': 1105.415, 'duration': 4.163}, {'end': 1115.523, 'text': 'Blah.gif This may prove to be handy in our next exercise.', 'start': 1110.299, 'duration': 5.224}, {'end': 1119.606, 'text': "So I've just showed you two functions in there.", 'start': 1118.145, 'duration': 1.461}, {'end': 1125.702, 'text': "Yes, I mean, in fact, there's a huge amount of stuff there for parsing URLs.", 'start': 1120.819, 'duration': 4.883}, {'end': 1128.463, 'text': 'I mean, you can imagine all sorts of stuff with URLs and HTTP, whatever.', 'start': 1125.842, 'duration': 2.621}, {'end': 1129.024, 'text': 'Yeah, of course.', 'start': 1128.503, 'duration': 0.521}, {'end': 1130.344, 'text': "There's tons of built-in behavior there.", 'start': 1129.164, 'duration': 1.18}, {'end': 1132.365, 'text': "And I've just showed you my favorites.", 'start': 1130.364, 'duration': 2.001}], 'summary': 'Demonstrated 2 functions for parsing urls, with potential for various http-related tasks.', 'duration': 26.95, 'max_score': 1105.415, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og1105415.jpg'}, {'end': 1230.738, 'src': 'embed', 'start': 1195.37, 'weight': 1, 'content': [{'end': 1199.172, 'text': 'And in order to solve the puzzle, I want you to tell me what is happy.', 'start': 1195.37, 'duration': 3.802}, {'end': 1200.212, 'text': 'What is that an image of?', 'start': 1199.432, 'duration': 0.78}, {'end': 1207.916, 'text': "Now, what's happened is some evil person has taken that image and they've shattered it like pinstripes into a bunch of little vertical stripes of images.", 'start': 1200.672, 'duration': 7.244}, {'end': 1210.677, 'text': "And so if you just have one stripe, you can't really tell what it is.", 'start': 1208.356, 'duration': 2.321}, {'end': 1211.757, 'text': "You've got to really put it all together.", 'start': 1210.697, 'duration': 1.06}, {'end': 1215.499, 'text': "And they've taken these stripes and they have scattered them over the internet somewhere.", 'start': 1212.138, 'duration': 3.361}, {'end': 1219.361, 'text': 'And each stripe has a URL that points to it.', 'start': 1216.359, 'duration': 3.002}, {'end': 1230.738, 'text': "And what's happened is if we look in this happy underbar blah, blah, blah Apache log file, and there's just all this junk in here.", 'start': 1220.677, 'duration': 10.061}], 'summary': "Image of 'happy' shattered into vertical stripes, scattered over internet with urls, found in apache log file.", 'duration': 35.368, 'max_score': 1195.37, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og1195370.jpg'}, {'end': 1308.196, 'src': 'embed', 'start': 1280.468, 'weight': 2, 'content': [{'end': 1285.476, 'text': 'So the ones with slash puzzle in them, those are the ones that point to the image slices.', 'start': 1280.468, 'duration': 5.008}, {'end': 1295.087, 'text': "And so your first job is process the entire log file, find all the puzzle URLs, and there's duplicates.", 'start': 1286.701, 'duration': 8.386}, {'end': 1298.449, 'text': 'So you have to eliminate duplicates and then sort them alphabetically.', 'start': 1295.207, 'duration': 3.242}, {'end': 1301.531, 'text': 'And then I want to just see the output nice and nice.', 'start': 1298.509, 'duration': 3.022}, {'end': 1308.196, 'text': 'Now, just for kind of regular expression purposes, without getting into a lot of detail about HTTP,', 'start': 1301.891, 'duration': 6.305}], 'summary': 'Process log file to find, eliminate duplicates, and sort puzzle urls alphabetically.', 'duration': 27.728, 'max_score': 1280.468, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og1280468.jpg'}, {'end': 1491.517, 'src': 'embed', 'start': 1461.047, 'weight': 3, 'content': [{'end': 1464.369, 'text': 'And in the Python imaging library, I could kind of composite these things together.', 'start': 1461.047, 'duration': 3.322}, {'end': 1465.89, 'text': 'Oh, and alphabetical order is correct.', 'start': 1464.69, 'duration': 1.2}, {'end': 1470.754, 'text': 'So alphabetical order will do the slices left to right the way you want for part A.', 'start': 1465.91, 'duration': 4.844}, {'end': 1472.035, 'text': 'But then I thought of an easier way.', 'start': 1470.754, 'duration': 1.281}, {'end': 1478.651, 'text': 'The totally easy way to do this is to just have Firefox put the images together for you.', 'start': 1473.168, 'duration': 5.483}, {'end': 1484.694, 'text': "And the way you're going to do that is let me just show you the contents of this index.html.", 'start': 1478.931, 'duration': 5.763}, {'end': 1486.475, 'text': 'Just look inside of there.', 'start': 1484.714, 'duration': 1.761}, {'end': 1491.517, 'text': "And what I've done, what you're going to do is just put a bunch of image tags together.", 'start': 1487.215, 'duration': 4.302}], 'summary': 'Composite images in python, use alphabetical order for slices, and create index.html with image tags.', 'duration': 30.47, 'max_score': 1461.047, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og1461047.jpg'}], 'start': 1105.415, 'title': 'Url parsing and apache log file processing', 'summary': 'Covers url parsing, introduces a puzzle exercise to reassemble an image, and discusses processing apache log files to extract puzzle urls, eliminate duplicates, sort them alphabetically, retrieve and rename image slices, and reassemble original images using firefox.', 'chapters': [{'end': 1211.757, 'start': 1105.415, 'title': 'Url parsing and puzzle exercise', 'summary': 'Covers url parsing and introduces a puzzle exercise where the solution is an image of something or someone very happy, shattered into vertical stripes, requiring reassembly.', 'duration': 106.342, 'highlights': ['The exercise introduced involves solving a puzzle to identify an image of something or someone very happy, shattered into vertical stripes, requiring reassembly.', 'The chapter also covers the parsing of URLs, offering a wide range of built-in behavior for handling URLs and HTTP.', 'The speaker demonstrates two functions and highlights the abundance of content available for parsing URLs, emphasizing the importance of exploring it for any URL-related tasks.']}, {'end': 1541.178, 'start': 1212.138, 'title': 'Processing apache log files', 'summary': 'Discusses processing apache log files to extract puzzle urls, eliminate duplicates, sort them alphabetically, retrieve and rename image slices, and reassemble original images using firefox, with a hint of a more complicated scheme for further difficulty.', 'duration': 329.04, 'highlights': ['Processing Apache log files to extract puzzle URLs, eliminate duplicates, and sort them alphabetically. The chapter discusses a program to process Apache log files, extract puzzle URLs, eliminate duplicates, and sort them alphabetically.', 'Retrieving and renaming image slices to reassemble original images using Firefox. Instructions are given for retrieving and renaming image slices to reassemble original images using Firefox.', "Hinting at a more complicated scheme for further difficulty in scrambling left to right order of images. There's a hint of a more complicated scheme for further difficulty in scrambling the left to right order of images."]}], 'duration': 435.763, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Nn2KQmVF5Og/pics/Nn2KQmVF5Og1105415.jpg', 'highlights': ['The chapter covers parsing of URLs and offers a wide range of built-in behavior for handling URLs and HTTP.', 'The exercise involves solving a puzzle to identify an image shattered into vertical stripes, requiring reassembly.', 'Processing Apache log files to extract puzzle URLs, eliminate duplicates, and sort them alphabetically.', 'Instructions are given for retrieving and renaming image slices to reassemble original images using Firefox.', 'The speaker demonstrates two functions and highlights the abundance of content available for parsing URLs.']}], 'highlights': ['Emphasizes the reusability and functionality of well-designed functions and modules within big software systems.', 'The chapter covers parsing of URLs and offers a wide range of built-in behavior for handling URLs and HTTP.', 'The chapter discusses the usage of Python modules like baby names and URL lib, demonstrating the ability to extract names and retrieve data from URLs.', 'The chapter emphasizes the need to handle errors in a way that allows the program to continue execution and provides a simple example of catching the IO error to achieve this.', 'The chapter explores the usage of the Python interpreter and the help function to access documentation, providing insight into the structure of Python files, including the main function and triple quoted string for documentation.']}