IPython 8.4.0 Pypi GitHub Homepage
Other Docs
sx(self, line='', cell=None)

%sx command

IPython will run the given command using commands.getoutput(), and return the result formatted as a list (split on '\n'). Since the output is _returned_, it will be stored in ipython's regular output cache Out[N] and in the '_N' automatic variables.

Notes:

  1. If an input line begins with '!!', then %sx is automatically

invoked. That is, while:

!ls

causes ipython to simply issue system('ls'), typing:

!!ls

is a shorthand equivalent to:

%sx ls
  1. %sx differs from %sc in that %sx automatically splits into a list,

like '%sc -l'. The reason for this is to make it as easy as possible to process line-oriented shell output via further python commands. %sc is meant to provide much finer control, but requires more typing.

.l (or .list) : value as list.
.n (or .nlstr): value as newline-separated string.
.s (or .spstr): value as whitespace-separated string.

This is very useful when trying to use such lists as arguments to system commands.

Shell execute - run shell command and capture output (!! is short-hand).

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/core/magics/osm.py#679
type: <class 'function'>
Commit: