UserPreferences

KazuoMoriwaka/Journal/2004-09-25


  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
#!/usr/local/bin/python2.3
#coding: euc-jp
import locale
import pyopenoffice
import sys
import os
import datetime
locale.setlocale(locale.LC_ALL, '')

inputfile = "atc.sxw"
outputfile = "atcout.sxw"

startdate = datetime.date(2004, 12, 1)
enddate = datetime.date(2004, 12, 31)
datelist = []

thedate = startdate
while thedate <= enddate:
    datelist.append({'date': unicode(thedate.strftime("%Y年%m月%d日(%a)"),
                                     'euc-jp')})
    thedate += datetime.timedelta(1)

tool = pyopenoffice.PyOpenOffice()

newfile = tool.makeSerialLetters(inputfile,datelist)
newsxw = open(newfile)
sxw = newsxw.read()
newsxw.close()
f = open(outputfile, "wb")
f.write(sxw)
f.close()