Rectangle Collisions is a free and open source tutorial on how to do side-based rectangle collisions. It's extremely simple, and not very hard to understand.
Basically how it works is when you move a rect, you first move along the X axis, test for a collision, move out, then move along the Y axis, test for a collision, and move out. This prevents the infamous "corner-catching" bug, and lets you move smoothly along walls.
NOTE: Rectangle Collisions is licensed and distributed under the terms of Public Domain.
Requirements:
· Python
· Pygame