4.3 write method

A write() method can be used to write the reconstructed file contents with the new settings, options, and potentially sections. This write method is available in the file object that is returned by the add_file() method of the ConfigParser or the set() method of an option object.

write( file)
file is a required positional argument. If file is a file object, the reconstructed file contents will be written using the file object's write() method. Otherwise it is expected that file is a file name string and the file will be opened and written to.

The two previous sections show example uses of this method.