#!/usr/bin/python
# -*- coding: utf8 -*-
import MySQLdb

db = MySQLdb.connect(host='localhost',
                     user='franta',
                     passwd='tojetajny',
                     db='obybatele')

query="""
SELECT jmeno,vek
FROM lidi
WHERE vek > 50 
"""
cursor = db.cursor()
cursor.execute(query)

data = cursor.fetchall()

db.close()

for radek in data:
    print "jméno:",radek[0],"věk:",radek[1]
