Reputation: 1441
I am running the following Python script in an OS X 10.8 terminal with a line length of about 200 characters. However the output from the script is wrapped at about line 80. How can I make the output lines continue until the console's length?
Here is my Python script:
import csv as csv
import numpy as np
#Open up the csv file in to a Python object
csv_file_object = csv.reader(open('./data/train.csv', 'rb'))
header = csv_file_object.next() #The next() command just skips the
#first line which is a header
data=[] #Create a variable called 'data'
for row in csv_file_object: #Run through each row in the csv file
data.append(row) #adding each row to the data variable
data = np.array(data) #Then convert from a list to an array
#Be aware that each item is currently a string in this format
for datum in data:
print datum[0:10]
The output I get is like:
['1' '3' 'Najib, Miss. Adele Kiamie "Jane"' 'female' '15' '0' '0' '2667'
'7.225' '']
['0' '3' 'Gustafsson, Mr. Alfred Ossian' 'male' '20' '0' '0' '7534'
'9.8458' '']
Upvotes: 3
Views: 321
Reputation: 3443
It's a setting of numpy's array representation, to have it the whole line, you would have to print every datum
yourself with str.join
.
Upvotes: 1