當前位置: 首頁>>代碼示例>>Python>>正文


Python Path.rmdir方法代碼示例

本文整理匯總了Python中src.tools.path.Path.rmdir方法的典型用法代碼示例。如果您正苦於以下問題:Python Path.rmdir方法的具體用法?Python Path.rmdir怎麽用?Python Path.rmdir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在src.tools.path.Path的用法示例。


在下文中一共展示了Path.rmdir方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_single_html_book

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import rmdir [as 別名]
 def create_single_html_book(self, book_package):
     title = book_package.get_title()
     if not title:
         # 電子書題目為空時自動跳過
         # 否則會發生『rm -rf / 』的慘劇
         return
     Path.reset_path()
     Path.chdir(Path.result_path)
     Path.rmdir(u'./' + title)
     Path.mkdir(u'./' + title)
     Path.chdir(u'./' + title)
     page = []
     for book in book_package.book_list:
         page += book.page_list
     content = u' \r\n '.join([Match.html_body(x.content) for x in page]).replace(u'../images/', u'./images/')
     with open(TemplateConfig.content_base_uri) as html:
         content = html.read().format(title=title, body=content).replace(u'../style/', u'./')
     with open(title + u'.html', 'w') as html:
         html.write(content)
     Path.copy(Path.html_pool_path + u'/../{}/OEBPS/images'.format(title), u'./images')
     Path.copy(Path.www_css + u'/customer.css', u'./customer.css')
     Path.copy(Path.www_css + u'/markdown.css', u'./markdown.css')
     Path.copy(Path.www_css + u'/normalize.css', u'./normalize.css')
     Path.reset_path()
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:27,代碼來源:book.py

示例2: create_single_html_book

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import rmdir [as 別名]
 def create_single_html_book(self):
     title = '_'.join([book.epub.title for book in self.book_list])
     title = title.strip()[:128] # 避開window文件名長度限製
     title = ExtraTools.fix_filename(title) # 移除特殊字符
     Path.reset_path()
     Path.chdir(Path.result_path)
     Path.rmdir(u'./' + title)
     Path.mkdir(u'./' + title)
     Path.chdir(u'./' + title)
     page = []
     for book in self.book_list:
         page += book.page_list
     content = ' \r\n<hr /> \r\n '.join([Match.html_body(x.content) for x in page]).replace('../images/', './images/')
     with open(Path.base_path + '/src/template/content/single_html.html') as html:
         template = html.read().format(title=title, content=content)
     with open(title + u'.html', 'w') as html:
         html.write(template)
     shutil.copytree(Path.html_pool_path + u'/../{}/OEBPS/images'.format(title), './images')
     shutil.copy(Path.www_css + '/front.css' , './front.css')
     shutil.copy(Path.www_css + '/markdown.css' , './markdown.css')
     Path.reset_path()
     return
開發者ID:GTagent,項目名稱:ZhihuHelp__Python,代碼行數:24,代碼來源:epub_creator.py

示例3: init_path

# 需要導入模塊: from src.tools.path import Path [as 別名]
# 或者: from src.tools.path.Path import rmdir [as 別名]
 def init_path(self):
     Path.rmdir(u'./' + self.title)
     Path.mkdir(u'./' + self.title)
     Path.chdir(u'./' + self.title)
     EpubPath.init_epub_path(Path.get_pwd())
     return
開發者ID:HowieWang,項目名稱:jianshu2e-book,代碼行數:8,代碼來源:epub.py


注:本文中的src.tools.path.Path.rmdir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。