You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
718 B
Python

#-*- coding: utf-8 -*-
import os
def walkFile(FilePath):
S='''{"0":['''
for root, dirs, files in os.walk(FilePath):
for f in files:
if f!='mini.py':
Path=os.path.join(root, f)
S+='"'+f+'",'
S+="]}"
S=S.replace(",]}", "]}")
print("正在写入文件,这通常不会太久...")
with open("./index.json","wb") as ff:
ff.write(S.encode("utf-8"))
print("恭喜,已成功完成")
if __name__=="__main__":
print("请坐和放宽,我们正帮你搞定一切......")
FilePath="."
try:
walkFile(FilePath)
except Exception as e:
print("生成失败!我们都有不顺利的时候.")
print(e)