The utilities module

A module which contains various utility methods for handling strings and floats.

utilities.is_number(s)[source]

Test a string to see if it is a number.

Parameters:s (string) – string which is being tested
Returns:True if s is a number, and False otherwise
Return type:boolean

Note

This method allows “d” and “D” as an exponent (i.e. for Fortran style numbers).

utilities.to_float(s)[source]

Convert a string to a float.

Parameters:s (string) – string which will be converted to a float
Returns:the corresponding float
Return type:float

Note

This method allows “d” and “D” as an exponent (i.e. for Fortran style numbers).

utilities.trim(s)[source]

Return a string with comments (starting with “#”) removed.

Parameters:s (string) – the string for which we would like to remove comments.
Returns:the string without comments
Return type:string