pythonadvanced
Configparser Ini
Advanced Python pattern: configparser-ini
pythonPress ⌘/Ctrl + Shift + C to copy
import configparser
cfg = configparser.ConfigParser()
cfg['app'] = {'host': 'localhost', 'port': '8000'}
with open('app.ini', 'w') as f:
cfg.write(f)
cfg.read('app.ini')
print(cfg['app']['host'])Use Cases
- advanced programming
- patterns
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
pythonbeginner
Type Hints
Advanced Python pattern: type-hints
Best for: advanced programming
#python#advanced
pythonintermediate
Dataclass
Advanced Python pattern: dataclass
Best for: advanced programming
#python#advanced
pythonadvanced
Abc Abstract
Advanced Python pattern: abc-abstract
Best for: advanced programming
#python#advanced
pythonbeginner
Enum Types
Advanced Python pattern: enum-types
Best for: advanced programming
#python#advanced