1

Quick question, I used sublime to code python, when I print output of a list (a very long list), the console automatically omit some values in the middle of list with dot.

['yes' 'yes' 'yes' ..., 'no' 'no' 'no']

How can I see all the values in the list?

HAO CHEN
  • 1,209
  • 3
  • 18
  • 32
  • I read values from a csv file and saved as an array, I want to print this array, because this array is very long, 2000 values in this array, so the console omit values, how can I print the all values? I just use code 'print array' – HAO CHEN Jan 05 '17 at 11:08
  • weird i try print 40k len charater in list, never omit output – Tyler Jan 05 '17 at 11:14
  • is it because I used numpy array to save data instead of using list? – HAO CHEN Jan 05 '17 at 11:15

1 Answers1

1

Do this before running your print(array) if you are on Python 3:

import sys
import numpy

numpy.set_printoptions(threshold=sys.maxsize)

Or this if you are on Python 2:

import sys
import numpy

numpy.set_printoptions(threshold=sys.maxint)
MattDMo
  • 100,794
  • 21
  • 241
  • 231
Evandro Coan
  • 8,560
  • 11
  • 83
  • 144