file io - Reading line by line in Julia -


I am trying to read from a file where each line has some integer

but when I gave it a

  f = open ("data.txt") a = readline (f) arr = int64 [] push! (Arr, int (a))  

I'm getting

  error: in any of load.jl there_from_node1 there is no method getindex (function): 120  

error comes from int64 [] because int64 is a function and you are trying to index it [] . To create an array of Int64 (note the case), you should use, like, arr = int64 [] .

Another problem with your code is int (a) - when you have an array of int64 , you also have the same type of parse Specify, like, push! (Arr, parseint (int 64, a))


Comments