try_parse method

On this page

try_parse

Converts the string representation of a size to its class equivalent.

def try_parse(cls, s, size):
    ...
Parameter Type Description
s str A string containing a size to convert.
size Size When the method returns, contains the instance of Size that is equivalent to the value specified in s if the conversion succeeded; otherwise, None.

Returns: bool: True if s is converted successfully; otherwise, False.

See Also

On this page