Python - How to keep list item decimal places for variable?

0

I'm using Python within SPSS to read some values within a dataset. These values are stored in a list. I am using 15 decimal places and in the list the values appear with 15 houses. However when I copy the value to a variable this stores with up to 12 houses. Ex. list = [0,123456789101112, 0,987654321012345]

x = lita [0]

When I use x it loads type 0.123456789.

This happens even though I use: x = float (list [0]). The Python version is 2.7.6 and SPSS 23.

    
asked by anonymous 23.06.2018 / 05:39

1 answer

1

I tested here with Python 2.7 and 3.6 and the result was the same

>>> lista = [0.123456789101112, 0.987654321012345]
>>> a=lista[0]
>>> lista[0]
0.123456789101112
>>> a
0.123456789101112

In other words, you printed the correct value

    
25.06.2018 / 19:08