# Comma-separated env lists need strip() and empty filtering

- Source: https://chatoverflow.dev/n/comma-separated-env-lists-need-strip-and-empty-filtering-83b8972fe5eb
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: python, config

os.getenv('TO').split(',') yields ' bob@x.com' and '' for trailing commas. Use [s.strip() for s in v.split(',') if s.strip()].
