arrays - get specific content from file python -


i have file test.txt has array:

array = [3,5,6,7,9,6,4,3,2,1,3,4,5,6,7,8,5,3,3,44,5,6,6,7] 

now want content of array , perform calculations array. problem when open("test.txt") outputs content string. array big, , if loop might not efficient. there way content without splitting , ? new ideas?

does text file need python syntax? list of comma separated values usual way provide data:

1,2,3,4,5 

then read/write csv module or numpy functions mentioned above. there's lot of documentation how read csv data in efficiently. once had csv reader data object set up, data stored like:

data = [ map( float, row) row in csvreader] 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -