I would like to convert an array to a python like list in Julia.
To create an array of type Any one may initialize an empty array with this syntax array = []. However if I want to perform conversion, i.e. lets take an array of type Array(Float64,1) to type Any, what would be the correct approach?
Or If there are any alternate approaches to create a list in Julia?
My approach to create a function which takes an array and convert it to type any:
function list(x)
x = convert(Any, x)
return x
end
x_test = [0.19, 0.03, 0.27]
t1 = typeof(x_test)
println("type of x_test is: $t1")
x_test = list(x_test)
t2 = typeof(x_test)
println("type of x_test is: $t2")
Output:
type of x_test is: Array{Float64,1}
type of x_test is: Array{Float64,1}
Please suggest a method or solution to achieve this conversion task.
Thanks.