Referring to the open file, it will not delete the previous data with Open (file_name, 'a'). PATH (file path), file_name (INI file name), Node (Node name) args (Ident list)
===
Def Write_File (Self, Path, File_Name, Node, ** args):
File_info = path file_name # get the path and file name
Value = args # gets a "key / value" pair
TRY:
INI_FILES = Open (file_info, 'a')
Except Ioerror:
Print "file is not open"
FILES_NAME_LIST = OS.LISTDIR (PATH)
If file_name in files_name_list: # Is there a file under the file path?
Self .__ config.add_section (node) # Add a node
For Con in Value.keys ():
Self .__ config.set (Node, Con, args [con]) # Add "key value" under a node
Self .__ config.write (INI_FILES) # Written the data into the INI file
INI_FILES.CLOSE ()
Return True
Else:
Return False
# end write_file (Self ...)