Strings are among the most commonly used data types in Python, and there might be times when you want to (or have to) work with strings containing or entirely made up of characters outside of the standard ASCII set (e.g. characters with accents or other markings). Python 2.x provides a data type called a Unicode Full Article…
Search the Wiki
Lists and Tuples
Two of the most commonly used built-in data types in Python are the list and the tuple. Lists and tuples are part of the group of sequence data types—in other words, lists and tuples store one or more objects or values in a specific order. The objects stored in a list or tuple can be Full Article…
Dictionaries
Among the built-in Python data types is a very versatile type called a dictionary. Dictionaries are similar to lists and tuples because they act as storage units for other objects or variables you’ve created. Dictionaries are different from lists and tuples because the group of objects they hold aren’t in any particular order, but rather Full Article…
Introduction to IPython: An Enhanced Python Interpreter
Simply put, IPython lets you do all sorts of really powerful stuff. It’s very popular amongst scientists and mathematicians, and has a lot of features that they seem to really appreciate. It also has a lot of features that are really useful to everyone else who uses Python. IPython offers lots of simple hooks for Full Article…
Working with Threads in Python
What are threads? Simply put, try to imagine them as running several programs concurrently, in a single process. When you create one or more threads in your program, they get executed simultaneously, independent of each other, and most importantly, they can share information among them without any extra difficulty. These features make threads lightweight and Full Article…
Working With Packages in Python
When you’ve got a large number of classes, you’ll want to organize them in packages. When the number of modules (simply stated, a module might be just a file containing some classes) in any project grows significantly, it is wiser to organize them in Packages – that is, placing functionally similar modules/classes in the same directory. Working with packages Full Article…
Adding Watermarks to Images (Watermark Tutorial 1)
When you take photographs and post it onto the internet, it is advisable to add a watermark to prevent and discourage unauthorized copies or image theft. Below is a simple python script that uses the PIL image module. It adds a visible text watermark to the image using the system font. We start with importing Full Article…
Setting Up the Python Environment with Virtualenv
Python is a very powerful scripting language. The language has lots of Python packages you can install and use in your projects. Sometimes, you may have different projects that need different versions of the same package/module. For example, let’s say you’re developing a Web application with the latest version of Django for a customer. At Full Article…
Recursive Directory Traversal in Python: Make a list of your movies!
What’s better than making a list of video files in your hard disc drive? Let’s make a list of all video files in a folder, and all other folders in it. Usage After writing the code, save the file with a .py extension, for example movie_list_maker.py. Then put the file in a directory where you’ve got movie Full Article…
Quick Yahoo Finance HTML scraper with BeautifulSoup
Python offers a lot of powerful and easy to use tools for automating data collection from the web. In this example we’ll create a ‘web scraper’ to get data from a Yahoo Finance page about stock options. It’s alright if you don’t know anything about stock options, the most important thing is that the website Full Article…