Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save physicshinzui/aea41a9a7c5b7eae7cd73726bddc5bc8 to your computer and use it in GitHub Desktop.
Save physicshinzui/aea41a9a7c5b7eae7cd73726bddc5bc8 to your computer and use it in GitHub Desktop.
IO tutorial in Julia
## How to write a string in a file.
open("myfile.txt", "w") do io
write(io, "Hello World")
end
open(f->read(f, String), "myfile.txt")
rm("myfile")
open("multiline.txt", "w") do io
for i in 1:10
write(io, "$i \n")
end
end
io = open("multiline.txt", "r")
stringvec= rstrip.(read(io, String))
#a = map(x -> parse(Int,x), stringvec)
show(stringvec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment