We've updated our popular "Raspberry Pi SPI and I2C Tutorial" with some Python examples.
One of our more popular tutorials shows how to use the SPI and I2C buses available on the Raspberry Pi GPIO header. It seems that people are interested in connecting hardware to the Raspberry Pi, which is definitely a good use for the tiny computer.
The original tutorial showed how to use the WiringPi library with C++ to talk to a SPI 7-segment display and an I2C digital-to-analog converter (DAC). While I do thoroughly enjoy C/C++, I figured giving Python examples alongside the C/C++ ones would give readers more options.
As might be expected, the C/C++ examples are faster and more efficient. However, since Python seems to be a popular way for writing quick scripts or prototyping, knowing how to use SPI and I2C protocols might help with your next Raspberry Pi project. The updated tutorial can be found here:
I used the smbus Python package in the tutorial, as that seems to be the de facto package for communicating over an I2C bus. However, it is lacking some of the lower level I2C functions, such as clock stretching, which limits its usefulness with some sensors that require it (like the Si7021). If you can recommend any I2C Python packages that are easy to use and can handle clock stretching, please let us know in the comments!