Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
Created October 21, 2011 19:43
Show Gist options
  • Save bkamapantula/1304749 to your computer and use it in GitHub Desktop.
Save bkamapantula/1304749 to your computer and use it in GitHub Desktop.
Read file in Python
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