Python is a powerful language that is easy to learn and excels at many different types of computing. It is used to run large, well-known websites. It is used to process log files and make sense of their contents. It might even be used to create some of your favorite games! Not only that, but with a simple, expressive syntax, Python doesn't have the gotchas and edge cases that make some other languages hard to learn.
In this course, instructor Derek Jenson will help you to learn to start coding with the Python language. You'll start with the very basics to lay a solid foundation for future learning. Then, you'll go deeper, learning more advanced ways of manipulating data with commonly used data structures. Later on, Derek will share some pointers with you about how to get data in and out of files and even store complex data structures in them. Finally, you'll learn about some of Python's powerful built-in networking features to write code that can talk to other computers on the internet.
Let's not wait any longer! Time to dive in.
Learn Python with our complete python tutorial guide, whether you're just getting started or you're a seasoned coder looking to learn new skills.
1.Introduction2 lessons, 11:32
2.Python Building Blocks6 lessons, 1:08:07
3.Controlling the Flow7 lessons, 1:20:10
4.Common Data Structures4 lessons, 46:49
5.Application Structure7 lessons, 1:15:12
6.Collections7 lessons, 46:55
7.File I/O6 lessons, 48:51
8.Networking5 lessons, 43:48
9.Connecting to Network Services3 lessons, 34:27
10.Conclusion1 lesson, 02:08
Python is amazing. Python is the first language you should learn. Python can babysit your children, and take your dog for a walk. How often on the Internet have we seen these outlandish claims but have oftentimes found it very difficult to substantiate any of them? Well, not today. Today, we're going to show you from beginning to end how you can start with very little knowledge of a programming language, such as Python, and learn the ins and outs and the fundamental building blocks of the language so much so that you'll begin being able to write applications right away. And then, we're gonna take that foundational knowledge and we're gonna move it up a level and we're gonna start to learn about data structures. And how Python is structured to very quickly and easily allow you to get in and out of a lot of the built in data structures and even allow you to make your own. Then we're gonna show you how you can interact with files, to be able to save dated files, read data from files, and even take complex objects and store them in files for later use. And then do you think that's it? Absolutely not, we're gonna take it a step farther and we're gonna start talking about networked applications. How can we use Python to create very complex client server type applications in a very simple way? Then how can we interact with other network services and protocols out on the internet? How can we interact with websites? How can we interact with FTP sites? How can we sync our computer's clock to network time protocol servers out on the internet? All sound outlandish and crazy but I'm telling you, these things are within all of our reach. So sit down with me and join me for a while as I take you through the entire story from soup to nuts to take you from an absolute beginner in Python programming to being able to write very sophisticated and useful applications for yourself today. Think it's outlandish? Not anymore. My name is Derek Jensen and welcome to Python.
Now like anything else, before you can learn to run you have to learn to walk, or maybe even crawl, depending on how much experience you have in software development, or even with Python in general. So the first thing that we're going to discuss is actually making sure that we have Python installed. And if we don't how to get it installed. So you can see here, I'm running on Windows 10 which was recently released. But you can definitely follow along with any sort of platform. You can run this on Mac. You can run it on a Linux distribution. Other versions of Windows, basically on just about any system. And that's one of the beautiful aspects of Python is that it's very flexible and there are versions that run on just about any operating system. So, the first thing that we wanna do is we wanna get it installed. Or If you want, you can actually check to see if it's installed and that's what I'm gonna do first. So, I'm gonna open up a command line prompt. And you can really run any sort of command line. You can run whatever your native terminal or command shell is on whatever operating system you're using. I'm gonna use Windows Powershell, but I could just as easily have used just the command line utility. So typically what you would do at this point, is you would try to determine whether or not you have Python installed. Now depending on how it's installed and where it's installed, that might vary. But typically what you're going to do is you're just going to type in the word Python. And then if you want to get very specific about which version you have Installed, you can then leave a space, type hyphen and capital V. So once you've done that, if you have Python installed, you should see something like this, where it says that I currently have Python version 2.7.10 installed. Now, this also can come into play with, depending on how you have your path or certain environment variables set up, depending on your operating system, but this is how I have mine set up. So basically in the past I have downloaded and installed Python 2.7.10. And when I did that it installed it into my C drive, into the Python27 folder, and that's by default. And while this is good and while this will definitely work and will probably get you through the vast majority of this course, we're kind of gearing our focus, at least a little bit, on more towards the Python version 3 side of the world. Now that's not to say most and possibly all the code samples we're going to go through may work on 2.7. But there's always an odd chance that it may not. So you can roll the dice and stick with 2.7 if you want, but I'm gonna show you a little trick, especially in Windows. And a very similar trick is going to work on either Mac or Linux,to kind of get these two different versions of Python to play well together. And being able to use them at the command line at the same time. So the reason that I can go into my command shell here, and just type in Python without a path, is because, on Windows, we deal with something called environment variables. So if I go ahead and I open up my System Properties on Windows, and I can take a look at my environment variables. Down here in the system variables if I scroll down just a little bit you'll see Path. Now this is kind of the mother of all system variables. Everything, or every location that's defined within Path is going to be accessible from the command line, without having to type in the full path. Now, I can go ahead and edit this. And this is a very long string. But I can promise you that somewhere in this very long string, sits the C colon backslash Python27 directory. So that means anything within here is accessible from the command line without having to type in C colon backslash Python27. Well, that's good if I'm running Python 2.7. Or I'm just happy with doing that. But what if I want to run both the 3.x and a 2.x version of Python. How do I do that? Well, it's actually pretty simple from the Windows side, because you're gonna install them in different places. Now I wanna show you how to install the 3.4 here in just a second. But let's just say I wanted to change what this looked like, what this Python looked like from the command line. Just by making a simple change. So what I can do is, I can come into my Python27 directory, and I can simply change the name of this file to Python27. By simply doing that I've made a very drastic change in the name of the file itself but the actual execution in the way that the file works doesn't change. So I can come back into my command line, and if I re-execute Python -V. All of a sudden is going to throw up all over itself because it can't find Python. It's looking through all those environment variables, the path environment variable specifically, and it can't find it. But if I were to change this to say Python27, all of a sudden it works again. So using that simple little trick, on the Windows side of the world. I'm now going to go into Python.org and I can go into the download section under Windows. And then, in here I can read all about the different versions for Windows, all the different releases. But then ultimately, I can go and grab the latest release, which just at the time of this recording, happens to be 3.4.3. I can scroll down to the bottom and I can go ahead and download which ever version is going to make sense for my system. And for our case, I'm simply going to download the X86 MSI installer. Now, I already have this downloaded, so I'll go ahead and cancel that. So if I were to go over to my downloads folder. We'll see in here that I actually have python_3.4.3 already downloaded. So if I go ahead and run this installer, you're gonna see that this is a very simple installer. I'll make sure I install it for all users. I'll select Next. And now it's gonna say, where do you want to install it? Well, I do want to install this in a different directory from my Python 2.7 just to keep things separated. And as you can see here, it's gonna name it very nicely for me. So go ahead and click next. And typically when it comes to the different customizations for Python, I typically choose all of the defaults, that should be fine. And then I'll select next and then I'll go through the process of actually installing Python 3.4.3. So, I'll go ahead and accept that. And then once it's finished downloading we'll come back and I'll show you the little naming trick, again. So as you can see here we have finally finished the installation, so I'll go ahead and click Finish. Now if I come back into my C drive ,you're going to see now that I have a Python27 and a Python34. So now I can come in here again, and the folder structure is going to look nearly identical with the same name executable. This is why I changed the name of the file in the Python27 directory. Now if I come back over here to my command line. And let's say I tried to execute Python -V again. Depending on your operating system, depending on how you installed this, this may or may not work. Now in my instance, this does not work because I have not included this new directory structure in my Path environment variables. So, I'm gonna copy this C:\Python34. And I'm going to come back into my environment variables, which I strategically left open. I gonna come off to the end here and I'm simply going to place a semicolon. And I'm going to paste this directory in here. That's all I'm going to do. So I'll go ahead and click OK, and OK, and then finally OK. So I'll come back in here to my PowerShell. And this time I'm going to re-execute my command. And this time it doesn't work either. Now typically when this type of thing happens, that means I'm gonna have to close down all of my shells, or all of my command lines, and start over. So let me come back out. And I'll open this back up again. And now if I were to type in python -V, now it works. And as you can see because I left off the version here, I didn't put on python 2.7, I was routed directly to my new C:\ Python34 directory, and that's the version of Python that I've got. So now I could choose to change the name of this again. I can say Python34. But since we're gonna be focusing on using this version of Python throughout this course, I'm gonna leave it off of there. So if I wanted to go back and use the old version, I could simply say I want to use Python27. And that way I could use that version. But since I'm gonna just try to keep things as brief and as simple as possible, I'm going to just strictly call the Python3.4 version Python. So that should hopefully make things hopefully a little bit more clear and a little bit easier for you to follow along with throughout the course. So now that we've gotten Python installed. What do we do next? Well, we're going to obviously need a command line utility like we have here. So use whichever one you choose to be your favorite. And then finally you're going to need some sort of text editor, and I'm going to be using Notepad++. So you can use any sort of text editor that you want to that you enjoy using on any different platform. Everything will work, you don't have to have a specific one. And we're gonna be working a little bit in the text editor, a little bit in the command line. And basically you can follow along anyway that you'd like. And I'll kinda point out the little differences here and there as we go. But for the most part, that'll you're really going to need, it's really that simple. So in the next section of the course, we're gonna start to discuss one of the first important features of interacting with Python. And it just so happens to be working with the interactive shell.