开发者

python: How many write access needed to write XML

开发者 https://www.devze.com 2023-03-16 11:40 出处:网络
I am writing a python module that writes data into an XML file. The piece of code that handles the write is:

I am writing a python module that writes data into an XML file. The piece of code that handles the write is:

from xml.dom.minidom import Document
#using DOMXml

main = Document() #create an XML Document

toFile = open('output.xml','w')

main.writexml(toFile, indent ='    ', newl="\n")
#writexml() is the operation from Document that was imported

toFile.close()

The final output.xml has the size of 422 bytes onto Gentoo OS. Given the default blocksize of Gentoo is 1024 bytes. I am wondering how many writes to disk that piece of code would generate (since it's dependant开发者_开发问答 on the file operation).

Thank you!


Run the program under strace to find out.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号