Kind of opposite this question .
Is there a way to tell Python "Don't burn to disk until I tell you." (by closing or cleaning the file)? I write to a file on the network and prefer to write the whole file at once.
In the meantime, I write to the StringIO buffer, and then write it to disk at the end.
No, a look at the python manual does not indicate the ability to set the buffer size to infinity.
Your current solution is basically the same concept.
You could use the idea of ββAlex, but I would be against it for the following reasons:
:
a = open("blah.txt", "w", 2 ** 31 - 1) for i in xrange(10000): a.write("a")
python,
, . , x=open('/tmp/za', 'w', 1000*1000*1000) - , * 100...;-). , , ...
x=open('/tmp/za', 'w', 1000*1000*1000)
, , .
, , , , , .
If you want this for other reasons, it may not help.
Source: https://habr.com/ru/post/1708377/More articles:How to reorganize several similar Linq-To-Sql queries? - c #common code snippets / templates in eclipse - eclipseAutomatically create a C # class - c #How to reorganize several similar Linq queries? - c #Handling disrespectful blackouts with plugs and sockets - unixHow to programmatically obtain keyboard shortcuts reserved by Mac OS X - carbonThe NullReferenceException was unhandled, the Object Reference was not set to the instance of the object - nullProgrammatically get / set Mac OSX as default for system keyboard - keyboardCall other program functions? - scriptingHow to protect the site from API crashes? - javascriptAll Articles