Sharedwww / pics / new / update.pyOpen in CoCalc
Author: William A. Stein
1
#!/usr/bin/python
2
PATH="/home/was/www/pics/new/"
3
4
import os
5
6
F = os.listdir(PATH)
7
F.sort()
8
F.reverse()
9
F = [x for x in F if x.find(".py") == -1 and x.find("index.html") == -1]
10
11
g = open(PATH+"/index.html","w")
12
g.write("""<html><head>
13
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
14
<title>William Stein's Photos</title>
15
<LINK REL=STYLESHEET TYPE="text/css"
16
HREF="/was.css" TITLE="was">
17
</head>
18
<body>
19
<h1><a href="/">William Stein's</a> Photos</h1>
20
<br>I also have some <a href="http://picasaweb.google.com/wstein">photos posted at Google Picasa</a>.<br><br>
21
<br>
22
<!--Here is my <a href="/gallery">free gallery creation software</a> for Linux.<hr> -->
23
""")
24
25
g.write('<table border=0 cellpadding=3 bgcolor="black">\n')
26
for x in F:
27
g.write('<tr><td bgcolor="white"><a href="%s">%s</a></td></tr>\n'%(x,x.replace("_"," ")))
28
29
g.write('</table>')
30
31
g.write('</body></html>')
32
33