running application config files written in Python
Magnus L. Hetland
mlh at idt.ntnu.no
Sat May 1 12:40:16 EDT 1999
David Steuber <trashcan at david-steuber.com> writes:
> Bjoern Giesler <un4e at rz.uni-karlsruhe.de> writes:
>
> b) I still have some wrinkles to work out with my signature. I have
> a fixed portion of text followed by the output of the fortune
> program. I can shorten the fixed portion easily enough. However, I
> don't know how to make fortune grab only short quotes. It is pot luck
> whether it is one line or ten.
Just a helpful suggestion...
--- begin shortfortune.py ---
#!/usr/bin/env python
import os,string
quote = os.popen("fortune").readlines()
while len(quote) > 4:
quote = os.popen("fortune").readlines()
for line in quote:
print string.rstrip(line)
---- end shortfortune.py ----
--
Magnus
Lie
Hetland http://arcadia.laiv.org <arcadia at laiv.org>
More information about the Python-list
mailing list