|
setup diary |
R | julia | ruby | python3 | |
読み込み | f<-file("index.html","r") d<-readLines(f) close(f) | f=open("index.html","r") d=readlines(f) close(f) | f=open("index.html","r") d=f.readlines f.close | f=open("index.html","r") d=f.readlines() f.close() |
ブロック | d=open("index.html","r") do f readlines(f) end | d=open("index.html","r"){|f|f.readlines} | with open("index.html","r") as f: d=f.readlines() | |
ファイル名 | d<-readLines("index.html") | d=readlines("index.html") | ||
全体読み込み | d<-readChar("index.html",file.info("index.html")$size,TRUE) | d=open(f->read(f,String),"index.html") | d=open("index.html","r"){|f|f.read} | with open("index.html","r") as f: d=f.read() |
書き込み | cat("Hello, world!",file="out.txt") | open(f->print(f,"Hello, world!"),"out.txt","w") | open("out.txt","w"){|f|f.print "Hello, world!"} | with open("out.txt","w") as f: f.write("Hello, world!") |
追加 | cat("Hello, world!",file="out.txt",append=TRUE) | open(f->print(f,"Hello, world!"),"out.txt","a") | open("out.txt","a"){|f|f.print "Hello, world!"} | with open("out.txt","a") as f: f.write("Hello, world!") |