In python, I'm 开发者_运维知识库using win32api to read and write INI settings as and when they are required into specific sections based on IDs.
Once I have finished with the section, I want to be able to delete the entire section from the INI file. How would I go about doing this using the win32api python library?
My proposal is to use native Python module for handling INI files ConfigParser. Have you tried it already? It has remove_section method that probably will work for you.
This is not a Python specific answer, but look into calling WritePrivateProfileString with the lpKeyName
parameter set to NULL
. With this parameter set to NULL
the entire section named in lpAppName
, including all entries within the section, is deleted.
精彩评论