List of files, directories in Python

A short python program that prints the list of all files inside the current directory and subdirectories. It prints filename with relative path to the current directory.
import os

for root, dirs, files in os.walk('./'):
   for name in files:       
       filename = os.path.join(root, name)
       print filename

You can also print the list of directories only (just print the dirs). Actually I needed this stuff to solve a problem from Google treasure hunt. Let me know if you want me to share the full source code of the solutions of Google treasure hunt. Also share your code, if you have any different idea!

calculate age from date of birth

calculate age from date of birth

this is the simple code for calculate age from date of birth

def calculate_age(born):
    today = date.today()
    try: 
        birthday = born.replace(year=today.year)
    except ValueError: # raised when birth date is February 29 and the current year is not a leap year
        birthday = born.replace(year=today.year, day=born.day-1)
    if birthday > today:
        return today.year - born.year - 1
    else:
        return today.year - born.year


if __name__ == "__main__":
    day, month, year = [int(x) for x in "7/11/1982".split("/")]
    born = date(year, month, day)
    print calculate_age(born)