python - Difference between ! and % in Jupyter Notebooks -


both ! , % allow run shell commands jupyter notebook.

% provided by ipython kernel , allows run "magic commands", many of include well-known shell commands. !, provided jupyter, allows shell commands run within cells.

i haven't been able find much comparing two, , simple shell commands cd, etc. main difference see % interactive , change location in shell while in notebook.

are there other points or rules of contrast when thinking symbol use shell commands in jupyter notebook?

! calls out shell (in new process), while % affects process associated notebook (or notebook itself; many % commands have no shell counterpart).
!cd foo, itself, has no lasting effect, since process changed directory immediayely terminates. %cd foo changes current directory of notebook process, lasting effect.


Comments

  1. I can set up my new thought from this post. It gives inside and out data. A debt of gratitude is in order for this significant data for all, pleasant bLog! its fascinating. much obliged to you for sharing. ExcelR Data Science Courses

    ReplyDelete

Post a Comment

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -