September 12, 2012 by
Mike Python provides robust exception handing baked right into the language. Exception handing is something every programmer will need to learn. It allows the programmer to continue their program or gracefully terminate the application after an exception has occurred. Python uses a try/except/finally convention. We'll spend some time learning about standard exceptions, how to create a […]
There are a lot of computer languages that include the ternary (or tertiary) operator, which is basically a one-line conditional expression in Python. If you're interested, you can read about the various ways it's rendered in other languages over on Wikipedia. Here we will spend some time looking at several different examples and why you […]
Python provides a very powerful logging library in its standard library. A lot of programmers use print statements for debugging (myself included), but you can also use logging to do this. It's actually cleaner to use logging as you won't have to go through all your code to remove the print statements. In this tutorial […]
List comprehensions in Python are very handy. They can also be a little hard to understand when and why you would use them. List comprehensions tend to be harder to read than just using a simple for loop as well. We'll spend some time looking at how to construct list comprehensions and learn how they […]
There are lots of different ways to download a file from the internet using Python. One popular way is to connect to an FTP server and download your files that way. So that is what we will be looking at in this article. All you need is your standard installation of Python. It includes a […]
Today we're going to take a look at the controversial easy_install method of installing Python modules and packages. We will also learn how to create our own *.egg files. You will need to go get the SetupTools package to follow along. This package doesn't support Python 3.x so if you need that, see pip or […]