format#

Variable.format(format)[source]#

Retrieve the string value with the specified numerical formatting.

Parameters:
formatstr

Format for the numeric value of the string. For example, '06.2f'. For more information, see the PyFormat documentation.

Returns:
str

String value with the specified numerical formatting.

Examples

>>> from pyaedt.application.Variables import Variable
>>> v = Variable("10W")
>>> assert v.format("f") == '10.000000W'
>>> assert v.format("06.2f") == '010.00W'
>>> assert v.format("6.2f") == ' 10.00W'