- Difficulty level: easy
- Time need to lean: 5 minutes or less
- Key points:
get_output
gets output of commandexpand_pattern
expand pattern from lists of variables
Function get_output(cmd)
returns the output of command (decoded in UTF-8
), which is a shortcut for subprocess.check_output(cmd, shell=True).decode()
.
In [1]:
Out[1]:
This function also accepts two options show_command=False
, and prompt='$ '
that can be useful in case you would like to present the command that produce the output. For example,
In [2]:
In [3]:
Out[3]:
The sequences should have the same length
In [4]:
An exception is made for variables of simple non-sequence types, in which case they are repeated in all expanded items
In [5]:
Out[5]: