예제 #1
0
    def floatToString(cls, f: float):
        ''' Converts the given float to a string,
        without resorting to the scientific notation '''

        ctx = Context()
        ctx.prec = 32
        d1 = ctx.create_decimal(repr(f))
        return format(d1, 'f')
예제 #2
0
def float_to_str(f):
    ctx = Context()
    ctx.prec = 50
    d1 = ctx.create_decimal(repr(f))
    f1 = format(d1, 'f')
    if f1[::-1][:2][::-1] == '.0':
        f1 = f1[::-1][2:][::-1]
    return f1
예제 #3
0
def float_to_str(inp):
    context = Context()
    context.prec = 20
    dec = context.create_decimal(repr(inp))
    return format(dec, 'f')
예제 #4
0
	True
	'''

    x = 0
    for i in s:
        if i == "(":
            x += 1
        elif i == ")":
            x -= 1
        if x < 0:
            return (False)
    return (not x)


ctx = Context()
ctx.prec = 17


def compile_ignore_case(pattern):
    '''
	Call re.compile with the IGNORECASE flag.
	'''

    return (re.compile(pattern, flags=re.I))


def check_if_ascii(s):
    try:
        s.encode("ascii")
        return (True)
    except UnicodeEncodeError: