Welcome, guest | Sign In | My Account | Store | Cart

Return a list from a ConfigParser option. By default, split on a comma and strip whitespaces.

Python, 4 lines
1
2
3
4
def getlist(option, sep=',', chars=None):
    """Return a list from a ConfigParser option. By default, 
       split on a comma and strip whitespaces."""
    return [ chunk.strip(chars) for chunk in option.split(sep) ]
Created by Georges Martin on Fri, 13 May 2011 (MIT)
Python recipes (4591)
Georges Martin's recipes (1)

Required Modules

  • (none specified)

Other Information and Tasks