Created
October 21, 2011 19:43
-
-
Save bkamapantula/1304749 to your computer and use it in GitHub Desktop.
Read file in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import* | |
col1_array = [] | |
col2_array = [] | |
col1_array_index = 1 | |
col2_array_index = 1 | |
for row in file("2columns.txt"): | |
row = row.split() | |
col1 = row[0] | |
col2 = row[1] | |
col1_array.insert(col1_array_index, col1) | |
col2_array.insert(col2_array_index, col2) | |
col1_array_index += 1 | |
col2_array_index += 1 | |
print "Length of Array 1 = ", len(col1_array) | |
print "Length of Array 2 = ", len(col2_array) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment