1 Star 0 Fork 78

Million./E-Books

forked from Ukins/E-Books 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
list_all_books.py 819 Bytes
一键复制 编辑 原始数据 按行查看 历史
hz 提交于 2018-01-22 17:55 . display book(s) num
import os
import sys
rootdir = "./"
readme_str = '# IT e-books collection \r\n ---------- \r\n'
file_tree_str = ""
all_book = []
for dir in os.listdir(rootdir):
if os.path.isdir(dir) and dir != r".git":
readme_str += "## " + dir +"\r\n"
file_tree_str += dir + "\r\n"
for file in os.listdir(dir):
if file in all_book:
print("Duplicate book. Book Name: " + dir + "/" + file)
sys.exit(1)
if os.path.isfile(os.path.join(rootdir, dir, file)):
readme_str += file + "\r\n"
file_tree_str += " " + file + "\r\n"
all_book.append(file)
print(file_tree_str)
print("Total books: " + str(len(all_book)))
readme_file = open(r"readme.md", "w")
readme_file.write(readme_str)
readme_file.close()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/evil_s_admin/E-Books.git
git@gitee.com:evil_s_admin/E-Books.git
evil_s_admin
E-Books
E-Books
master

搜索帮助