import re


def convertpstring(string):
    """
    converts a string of the form 7p5 to 7.5 float

    Parameters
    ----------
    string : str
        String needing replacement

    Returns
    -------
    f : float
        Converted value
    """

    regex = r"(\d+)p(\d+)"
    m = re.search(regex, string)
    if m is not None:
        stringnew = m.groups()[0] + "." + m.groups()[1]
        f = (float(stringnew))
    else:
        f = (float(string))

    return f