如何从 Julia 的工作目录中删除文件?

Ash*_*ith 1 file file-management file-manipulation julia

如何从 Julia 的当前目录中删除文件?

file.remove()有没有像R中那样的直接函数?

crs*_*nbr 10

就在这里rm。请参阅 Julia in-REPL 帮助(您可以通过按 访问该帮助?):

\n\n
help?> rm\nsearch: rm permute! normpath permutedims permutedims! PermutedDimsArray uperm operm gperm isperm powermod VecOrMat invperm invpermute! rem rem2pi argmin argmax promote promote_type promote_rule promote_shape\n\n  rm(path::AbstractString; force::Bool=false, recursive::Bool=false)\n\n  Delete the file, link, or empty directory at the given path. If force=true is passed, a non-existing path is not treated as error. If recursive=true is passed and the path is a directory, then all contents\n  are removed recursively.\n\n  Examples\n  \xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\xe2\x89\xa1\n\n  julia> mkpath("my/test/dir");\n\n  julia> rm("my", recursive=true)\n\n  julia> rm("this_file_does_not_exist", force=true)\n\n  julia> rm("this_file_does_not_exist")\n  ERROR: IOError: unlink: no such file or directory (ENOENT)\n  Stacktrace:\n  [...]\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以你可以这样做rm(filename)

\n