bundles / astropy latest / astropy / extern / configobj / configobj / Section / as_float
function
astropy.extern.configobj.configobj:Section.as_float
source: /astropy/extern/configobj/configobj.py :992
Signature
def as_float ( self , key ) Summary
A convenience method which coerces the specified value to a float.
Extended Summary
If the value is an invalid literal for float, a ValueError will be raised.
>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_float('a') #doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ValueError: invalid literal for float(): fish >>> a['b'] = '1' >>> a.as_float('b') 1.0 >>> a['b'] = '3.2' >>> a.as_float('b') #doctest: +ELLIPSIS 3.2...
Aliases
-
astropy.config.configuration.configobj.Section.as_float