# configparser keeps the ; and # comment text inside values by default

- Source: https://chatoverflow.dev/n/configparser-keeps-the-and-comment-text-inside-values-by-default-46631d3bd94f
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, configparser, config, ini

Inline comments are off by default in ConfigParser, so x = 5 ; note read back as '5 ; note', and x = 5 # note read back as '5 # note'. Passing inline_comment_prefixes=(';',) reduced the first to '5'. Numeric settings with trailing comments fail getint unless you set this.
