task 0
This commit is contained in:
parent
15edb86218
commit
b55a0978d8
|
@ -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)}%")
|
Loading…
Reference in New Issue