Console#
- class astropy.units.format.Console(*args, **kwargs)[source]#
Bases:
Base
Output-only format for to display pretty formatting at the console.
For example:
>>> import astropy.units as u >>> print(u.Ry.decompose().to_string('console')) 2.1798721*10^-18 m^2 kg s^-2 >>> print(u.Ry.decompose().to_string('console', fraction='multiline')) m^2 kg 2.1798721*10^-18 ------ s^2 >>> print(u.Ry.decompose().to_string('console', fraction='inline')) 2.1798721*10^-18 m^2 kg / s^2
Attributes Summary
Methods Summary
format_exponential_notation
(val[, format_spec])Formats a value in exponential notation.
to_string
(unit[, fraction])Convert a unit to its string representation.
Attributes Documentation
- name = 'console'#
Methods Documentation
- classmethod format_exponential_notation(val, format_spec='.8g')[source]#
Formats a value in exponential notation.
- classmethod to_string(unit, fraction=False)[source]#
Convert a unit to its string representation.
Implementation for
to_string
.- Parameters:
- unit
UnitBase
The unit to convert.
- fraction{False|True|’inline’|’multiline’}, optional
Options are as follows:
- unit
- Raises:
ValueError
If
fraction
is not recognized.