寫入 cfg 不清除註解 === 建立 `ConfigParser` 物件時加上參數 `allow_no_value=True` ```python= config = configparser.ConfigParser(comment_prefixes='/', allow_no_value=True) ``` ## Ref. [python修改ini保留注释_更新INI文件而不删除注释](https://blog.csdn.net/weixin_39670441/article/details/110968373?utm_medium=distribute.pc_relevant_download.none-task-blog-2~default~BlogCommendFromBaidu~default-4.test_version_3&depth_1-utm_source=distribute.pc_relevant_download.none-task-blog-2~default~BlogCommendFromBaidu~default-4.test_version_) ###### tags: `實作相關`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up