def extract_ints_from_str(str):
    """
    Extract all integers from a string.

    Parameters
    ----------
    str : str
        The input string.

    Returns
    -------
    ints : list
        List of integers in `str`.

    Examples
    --------
    >>> extract_ints_from_str("I have 2 apples and 4 pears")
    [2, 4]
    >>> extract_ints_from_str("I have 0.5 apples and 4 pears")
    [4]
    >>> extract_ints_from_str("I have no apples and no pears")
    []
    """
    ints = [int(i) for i in str.split() if i.isdigit()]
    return ints