Python 101: Reading and Writing CSV Files

Python has a vast library of modules that are included with its distribution. The csv module gives the Python programmer the ability to parse CSV (Comma Separated Values) files. A CSV file is a human readable text file where each line has a number of fields, separated by commas or some other delimiter. You can

Python 101: Reading and Writing CSV Files Read More »

Python Concurrency: An Intro to Threads

Python has a number of different concurrency constructs such as threading, queues and multiprocessing. The threading module used to be the primary way of accomplishing concurrency. A few years ago, the multiprocessing module was added to the Python suite of standard libraries. This article will be focused on the threading module though.

Python Concurrency: An Intro to Threads Read More »

eBook Review: Learning scikit-learn: Machine Learning in Python

The people at Packt Publishing recently sent me an ebook copy of Raúl Garreta and Guillermo Moncecchi’s book, Learning scikit-learn: Machine Learning in Python to review. Machine learning isn’t a topic I’m very familiar with, but I gave the book a shot as it sounded interesting. I’ll start off with my quick review for those

eBook Review: Learning scikit-learn: Machine Learning in Python Read More »

Python: How to Create Rotating Logs

Python’s logging module has lots of options. In this article, we will looks at the logging module’s ability to create Rotating Logs. Python supports two types of rotating logs: Rotate logs based on size (RotatingFileHandler) Rotate the logs based on some time interval (TimedRotatingFileHandler) Let’s spend some time learning how each of these two types

Python: How to Create Rotating Logs Read More »

wxPython: How to Catch All Exceptions

One of my friends on the wxPython Google Group asked how to catch any exception that happens in wxPython. The problem is complicated somewhat because wxPython is a wrapper on top of a C++ library (wxWidgets). You can read about the issue on the wxPython wiki. Several wxPython users mentioned using Python’s sys.excepthook to catch

wxPython: How to Catch All Exceptions Read More »

How to Time Small Pieces of Python Code with timeit

Sometimes when you are coding, you want to know how long it takes for a particular function to run. This topic is known as profiling or performance tuning. Python has a couple of profilers built into its Standard Library, but for small pieces of code, it’s easier to just use Python’s timeit module. Thus, timeit

How to Time Small Pieces of Python Code with timeit Read More »