This commit is contained in:
Hladu357 2025-04-12 17:46:32 +03:00
parent 15edb86218
commit b55a0978d8
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
f = open("xml-sample-file.xml", "r")
s = f.read()
l = 0
idx = 0
while True:
beg = s.find("</", idx)
if beg < 0:
break
end = s.find(">", beg)
l += end - beg + 1
idx = end + 1
f.close()
print(f"{l}/{len(s)} ~= {int(l/len(s) * 100)}%")