Python Division Many Decimal Places
Question: Hi I'm wondering how to get python to output an answer to many more decimal
places than the default value.

For example: Currently print(1/7) outputs: 0.14285714285

I want to be able to output:0.142857142857142857142857142857142857142857142857


Answer: If you want completely arbitrary precision (which you will pretty much need to
get at that level of precision), I recommend looking at the
[`mpmath`](http://mpmath.org/) module.

    
    
    >>> from mpmath import mp
    >>> mp.dps = 100
    >>> mp.fdiv(1.0,7.0)
    mpf('0.1428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428579')
    

I suppose if all you want is to be able to do very simple arithmetic, the
builtin `decimal` module will suffice. I would still recommend `mpmath` for
anything more complex. You could try something like this:

    
    
    >>> import decimal
    >>> decimal.setcontext(decimal.Context(prec=100))
    >>> decimal.Decimal(1.0) / decimal.Decimal(7.0)
    Decimal('0.1428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571429')
    

