문제

How can you rename a section in a ConfigParser object?

도움이 되었습니까?

해결책 2

As far as I can tell, you need to

다른 팁

example helper function - silly really but it might save someone a few minutes work...

def rename_section(cp, section_from, section_to):
    items = cp.items(section_from)
    cp.add_section(section_to)
    for item in items:
        cp.set(section_to, item[0], item[1])
    cp.remove_section(section_from)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top