problem with a css cycler

Adriano Varoli Piazza moranar at
Sat Mar 20 23:29:12 CET 2004

Hello all
I am trying to build a css cycler in python, to change the css used in a 
website every X number of days, using a list of files: the first X days 
it'd show file1, then file2, then file3, then back to the first one.

The code I came up with is the following:

css = ["file1", "file2", "file3"]
i = 0
max_i = 3
today = int(raw_input("today's date: "))
stored_day = 1

if 3 <= (today - stored_day):
	stored_day = today
	i += 1
	if i > max_i:
		i = 0
print "Variable today is %s .\n" % today
print "Variable stored_day is %s .\n" % stored_day
print "Variable i is %s .\n" % i
print "Variable css is now %s \n" % css[i]
The problem with this is that it works only for the first X days. How do 
I make it "keep state" for the next iterations?

Adriano Varoli Piazza
The Inside Out:
ICQ: 4410132
MSN: adrianomd at
Claves gpg / pgp en hkp://

More information about the Python-list mailing list