アットウィキロゴ

江戸時代

import zipfile
 
title="練習"
author="匿名希望"
com="自費出版"
 
f1=open("epub/item/xhtml/p-titlepage.xhtml","r",encoding="UTF-8")
x1=[]
for line in f1:
    x1.append(line)
f1.close()    
 
y1=[]
for line in x1:
    line=line.replace("題名はここ",title)
    line=line.replace("著者はここ",author)
    y1.append(line)
 
f1x=open("p-titlepage.xhtml","w",encoding="UTF-8")
 
for line in y1:
    f1x.write(line)
f1x.close()   
 
f2=open("epub/item/xhtml/p-colophon.xhtml","r",encoding="UTF-8")
x2=[]
for line in f2:
    x2.append(line)
f2.close()    
 
y2=[]
for line in x2:
    line=line.replace("題名はここ",title)
    line=line.replace("著者はここ",author)
    line=line.replace("出版社はここ",com)
    y2.append(line)
 
f2x=open("p-colophon.xhtml","w",encoding="UTF-8")
 
f3=open("epub/item/xhtml/p-toc.xhtml","r",encoding="UTF-8")
 
x3=[]
for line in f3:
    x3.append(line)
f3.close()    
 
y3=[]
for line in x2:
    line=line.replace("題名はここ",title)
    line=line.replace("著者はここ",author)
    line=line.replace("出版社はここ",com)
    y3.append(line)
 
f3x=open("p-toc.xhtml","w",encoding="UTF-8")
 
for line in y3:
    f3x.write(line)
f3x.close()   
 
zipFile = zipfile.ZipFile('com.zip', 'w', zipfile.ZIP_STORED)
zipFile.write('epub/mimetype','mimetype')
zipFile.write('epub/META-INF/container.xml','META-INF/container.xml')
zipFile.write('epub/item/style/book-style.css','item/style/book-style.css')
zipFile.write('epub/item/style/style-standard.css','item/style/stylestyle-standard.css')
zipFile.write('epub/item/style/fixed-layout-jp.css','item/style/fixed-layout-jp.css')
zipFile.write('epub/item/style/style-advance.css','item/style/style-advance.css')
zipFile.write('epub/item/style/style-check.css','item/style/style-checke.css')
zipFile.write('epub/item/style/style-reset.css','item/style/style-reset.css')
zipFile.write('epub/item/xhtml/p-caution.xhtml','item/xhtml/p-caution.xhtml')
zipFile.write('epub/item/xhtml/p-cover.xhtml','item/xhtml/p-cover.xhtml')
zipFile.write('p-titlepage.xhtml','item/xhtml/p-titlepage.xhtml')
zipFile.write('p-colophon.xhtml','item/xhtml/p-colophon.xhtml')
zipFile.write('p-toc.xhtml','item/xhtml/p-toc.xhtml')
zipFile.close()
 
最終更新:2018年02月12日 10:52