Hi,

yes, it works almost the same:

julia> eval(parse("[1,2,3]"))
3-element Array{Int64,1}:
 1
 2
 3


parse parses the string into an expression (abstract syntax tree, AST), and 
eval, well, evaluates ;-)

But take care, any valid code inside the string will get executed.

Rene




Am 31.08.2015 um 11:48 schrieb Ali Rezaee <arv.ka...@gmail.com>:

> How can I convert the string representation of an array, such as the 
> following string, into an Array?
> 
> 
> s = "[1,2,3]"
> 
> I am reading these strings from a file and I am looking for an easy way to 
> have them as a list.
> In Python I would use eval function. Is there an alternative in Julia?
> 
> Many thanks,
> 
> Ali
> 

Reply via email to