Issue
In jupyter notebook
, we can execute a shell command using the exclamation mark, such as:
!ls *.png
I am looking for a way to pass arguments to this command, something like:
extention='*.png'
!ls %extention
I know this is possible using os.system or subprocess.check_output, but I want to use the exclamation mark as this will give me live output.
Solution
This is possible using {}
, such as:
extention='*.png'
!ls {extention}
Answered By - Ali Hassaine
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.