3 Star 5 Fork 3

Gitee 极速下载/SuperTinyIcons

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/edent/SuperTinyIcons
克隆/下载
update_readme.py 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
import os
import xml.etree.ElementTree as ET
import re
table_length = 6
counter = 0
svg_list = sorted(os.listdir('images/svg/'))
total_bytes = 0
table = "<table>\n"
for svg in svg_list:
name = ET.parse('images/svg/'+svg).getroot().attrib["aria-label"]
bytes = os.stat('images/svg/'+svg).st_size
total_bytes += bytes
if counter == 0 :
table += "<tr>\n"
table += f"<td>{name}<br>"
table += f"<img src=\"https://edent.github.io/SuperTinyIcons/images/svg/{svg}\" width=\"100\" title=\"{name}\"><br>"
table += f"{bytes} bytes</td>\n"
counter +=1
if counter == 6 :
table += "</tr>\n\n"
counter = 0
if counter != 0 :
table += "</tr>\n\n"
table += "</table>"
summary_text = f"There are currently {len(svg_list)} icons and the average size is _under_ {round(total_bytes / len(svg_list))} bytes!"
with open('README.md','r+') as f:
file = f.read()
file = re.sub(r"(?s)<table>.*?</table>", table, file)
file = re.sub("There are currently \d* icons and the average size is _under_ \d* bytes\!", summary_text, file)
f.seek(0)
f.write(file)
f.truncate()
print(f"README.md updated with {len(svg_list)} icons.")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML/CSS
1
https://gitee.com/mirrors/SuperTinyIcons.git
git@gitee.com:mirrors/SuperTinyIcons.git
mirrors
SuperTinyIcons
SuperTinyIcons
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385