#!/usr/bin/env python import sys, os, random if len( sys.argv ) > 1: file = sys.argv[1] else: file = os.getenv( 'HOME' ) + '/.taglines'; f = open( file, 'r' ) taglines = [] tagline = f.readline() while tagline: buff = f.readline() while (buff != "") and (buff != "\n"): tagline += buff buff = f.readline() taglines.append( tagline ) tagline = f.readline() f.close i = random.randrange( 0, len( taglines ) - 1 ) print taglines[i][:-1]