[Tutor] Generating sigs with Python for fun and education

lumbricus@gmx.net lumbricus@gmx.net
Tue, 13 Aug 2002 00:19:37 +0200 (MEST)


> Hi there, 

Hello!

> My mail program, kmail (part of KDE for Linux) has an option which lets
> you 
> use the output of a program as a signature. So I got this idea to use 
> Python to dynamically generate signatures instead of having a boring, 
> static one. 

You know about fortune?
man fortune 

[ snip ]

> real_days = {'Mon' : 'Monday',
>              'Tue' : 'Tuesday',
>              'Wed' : 'Wednesday',
>              'Thu' : 'Thursday',
>              'Fri' : 'Friday',
>              'Sat' : 'Saturday',
>              'Sun' : 'Sunday'}
> 
> now_list = time.asctime(time.localtime(time.time())).split()

There is no need for that real_days-trick:
$ python
Python 1.5.1 (#1, Apr  7 1999, 08:54:31) [C] on osf1V4
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import time
>>> time.strftime("%A", time.localtime(time.time()))
'Tuesday'
>>> 
$ man 3 strftime

[ snip ]

HTH, HAND
J"o!

-- 

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net