[Evolution] Signature script
- From: Trey Sizemore <trey fastmail fm>
- To: Evolution <evolution ximian com>
- Subject: [Evolution] Signature script
- Date: 15 Mar 2003 18:12:08 -0500
I saw a post where someone had given a sample Python script to randomly
generate sigs pulled from a text file. I copied the script and made it
executable, but the actual pulling of lines from the text file doesn't
seem to work (see below). Here is the script (in my /home/trey
directory):
#!/usr/bin/python
# change this to point to your file of quotes
aff_file = "/home/trey/quotes.txt"
import string, random
# hack this at will
print "---<br>"
print "Cheers,<br>"
print "Trey<br>"
print "---<br>"
print "<br>"
print "Today's Affirmation (selected automatically just for you):<br>"
print "<br>"
# cryptic python stuff which pulls a line from a text file
# at random
affs = file(aff_file).readlines()
aff = affs[int(random.random() * len(affs))].split("\n")[0]
# print the randomly selected line
print aff
The text file referenced is also in my /home/trey directory and looks
like this:
This is a test.
Another test line.
This is a sample line.
One quote per line as recommended.
What did I do wrong?
---
Cheers,
Trey
---
Today's Affirmation (selected automatically just for you):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]