Resize an Image with Python 2.x (and in Batch)
The module we use in this recipe to resize an image with Python is PIL. At the time of writing, it is only available for Python 2.x. If you want to do more with image editing, be sure to checkout our...
View ArticlePython Beautiful Soup Example: Yahoo Finance Scraper
Python offers a lot of powerful and easy to use tools for scraping websites. One of Python’s useful modules to scrape websites is known as Beautiful Soup. In this example we’ll provide you with a...
View ArticleRecursive Python Function Example: Make a List of Your Movies!
This recipe is simply a recursive Python function example, using Python’s os.listdir function. This is only an example of recursion in Python, however not the most effective method to traverse a...
View ArticleWatermark your Images in Python 2.x
The module we use in this recipe to resize an image with Python is PIL. At the time of writing, it is only available for Python 2.x. Also, if you wish to do other things with images, checkout our...
View ArticleRecursive File and Directory Manipulation in Python (Part 1)
If you are looking to utilize Python to manipulate your directory tree or files on your system, there are many tools to help, including Python’s standard os module. The following is a simple/basic...
View ArticleRecursive File and Directory Manipulation in Python (Part 2)
In Part 1 we looked at how to use the os.path.walk and os.walk methods to find and list files of a certain extension under a directory tree. The former function is only present in the Python 2.x, and...
View ArticleRecursive File and Directory Manipulation in Python (Part 3)
In Part 2 of this series we expanded our file-searching script to be able to search for multiple file extensions under a tree, and to write the results (all paths to files of matching extensions found)...
View ArticleHow to Move/Copy a File or Directory (Folder) with a Progress Bar in Python
In the last article, titled How to Recursively Copy a Folder (Directory) in Python, I covered how to copy a folder recursively from one place to another. As useful as that is, there is still something...
View ArticleFinding Duplicate Files with Python
Sometimes we need to find the duplicate files in our file system, or inside a specific folder. In this tutorial we are going to code a Python script to do this. This script works in Python 3.x. The...
View ArticleValidate Python Function Parameter & Return Types with Decorators
Overview So I was playing around with Python decorators the other day (as you do). I always wondered if you could get Python to validate the function parameter types and/or the return type, much like...
View Article