在 中jupyter notebook,我们可以使用感叹号执行 shell 命令,例如:
!ls *.png
Run Code Online (Sandbox Code Playgroud)
我正在寻找一种将参数传递给该命令的方法,例如:
extention='*.png'
!ls %extention
Run Code Online (Sandbox Code Playgroud)
我知道使用os.system或subprocess.check_output可以做到这一点,但我想使用感叹号,因为这会给我实时输出。