Welcome to Python for Everybody. We are going to be talking about some code, if you want to download all the codes it's right here, it's all single big zip file and all the sample code the one I'm going to talk about is urllib1.py, it is not very exciting, it's not short. That's what's kind o nice about Python code. If we go and take a look at the code we played with just previously which is socket. The idea here is urllib is something that Python has produced for us, to make socket communications and HTTP communications a lot better. So, this is making socket calls underneath it but there's a library that makes this quite simple. So, we have to do some imports, and instead of importing socket we'll import these or we're going to create a handle. Urllib request URL open and just pass in a string. So, we're not encoding this, we're not sending a GET command, all the stuff we did in the previous sockets example is gone. Then we can just put this as a fore loop and so we're not using this lower level read and write code, we're just using a fore loop, and so that literally is going to read the text line by line. The line does come back as an array of bytes, so you have to do a decode, but then we got a string and then we can do a strip on it. So this is like a super simple. So, there we go. Now the interesting thing is is you also don't see the headers, we just read the contents. Now, it turns out in urllib and we'll see this in later more complex application, you can get the headers if you want, you can get various other things. So, that's urllib, a simple urllib tool. Now we can also use this in urlwords to show you something quite interesting and that is, if you look at this from right here other than the decode, this is exactly the code we wrote to compute the words, right? So, and then this line.decode, this is just a open something up, in this case we're going to open a url or to create a dictionary, we're going to loop through each of the lines in that thing, we're going to decode them and then split them. So once you do line.decode this is now a legitimate internal Python string, we split it, we run through the words and run the counts. So this is exactly like code that we did before to run counts. So, python3 urlwords, and so that gives us a dictionary which is the word frequency. We could do all kinds of crazy stuff in here with the sorting and all the kinds of things, the important thing is once you've done this and this, the code, I do not need to decode these lines when you first get them, it really works just like makes a urllib makes urls function inside Python very much like files. So these are sort short into the point and very simple and I hope that they were useful to you.