Created
August 26, 2021 23:17
-
-
Save physicshinzui/aea41a9a7c5b7eae7cd73726bddc5bc8 to your computer and use it in GitHub Desktop.
IO tutorial in Julia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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