Search code examples
pythongentoo

python: How many write access needed to write XML


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!


Solution

  • Run the program under strace to find out.