在 Julia 中,您可以使用问号后跟函数名称,即?functionname来获取有关函数的信息。
如果您正在使用REPL,问号会将您的julia>提示切换为help?>提示 - 类似于]触发pkg>REPL 模式的方式。查看文档以获取更多信息。
在 Jupyter 笔记本 (IJulia) 中,您只需键入,?println并且没有可见的 REPL 模式更改。
例子:
help?> println # I typed ?println
search: println printstyled print sprint isprint
println([io::IO], xs...)
Print (using print) xs followed by a newline. If io is not supplied, prints to stdout.
Examples
??????????
julia> println("Hello, world")
Hello, world
julia> io = IOBuffer();
julia> println(io, "Hello, world")
julia> String(take!(io))
"Hello, world\n"
Run Code Online (Sandbox Code Playgroud)
请注意,此方法不限于函数。它适用于所有附加了一些文档字符串的对象:
help?> Sys.CPU_THREADS # docstring of a constant
Sys.CPU_THREADS
The number of logical CPU cores available in the system, i.e. the number of threads that the CPU can run concurrently. Note that this is not necessarily the number of CPU cores, for example, in the presence of hyper-threading (https://en.wikipedia.org/wiki/Hyper-threading).
See Hwloc.jl or CpuId.jl for extended information, including number of physical cores.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
837 次 |
| 最近记录: |