I have a config file what looks like: config.cfg
[sectioname1]some:thing,some2:thing2,some3:thing3[sectioname2]some:thing,some2:thing2,some3:thing3
I tried to delete the first section with this def:
def deleteSection(section): path= 'config.cfg' config.remove_section(section) with open(path, "w") as config_file: config.write(config_file)
How I try to call it in main:
if __name__=='__main__':if args.job=='delete': delete(args.Section)
But right now it's delete everything in the file.