Logo Search packages:      
Sourcecode: feed2omb version File versions  Download package

def configobj::Section::as_list (   self,
  key 
)
A convenience method which fetches the specified value, guaranteeing
that it is a list.

>>> a = ConfigObj()
>>> a['a'] = 1
>>> a.as_list('a')
[1]
>>> a['a'] = (1,)
>>> a.as_list('a')
[1]
>>> a['a'] = [1]
>>> a.as_list('a')
[1]

Definition at line 1032 of file configobj.py.

                          :
        """
        A convenience method which fetches the specified value, guaranteeing
        that it is a list.
        
        >>> a = ConfigObj()
        >>> a['a'] = 1
        >>> a.as_list('a')
        [1]
        >>> a['a'] = (1,)
        >>> a.as_list('a')
        [1]
        >>> a['a'] = [1]
        >>> a.as_list('a')
        [1]
        """
        result = self[key]
        if isinstance(result, (tuple, list)):
            return list(result)
        return [result]
        


Generated by  Doxygen 1.6.0   Back to index