Equivalent of Python's 'with' in Julia?
Use a do
block. Docs on do blocks are here.
And here is an example of how to do the usual with open(filename) as my_file
of Python in Julia:
open("sherlock-holmes.txt") do filehandle
for line in eachline(filehandle)
println(line)
end
end
The above example is from the Julia wikibooks too.