简体   繁体   English

如何将 %cat 添加到 IPython?

[英]How do I add %cat to IPython?

I just started using IPython and learning from the tutorials.我刚开始使用 IPython 并从教程中学习。 I have created a file but when I use the %cat command I get ERROR: Line magic function %cat not found.我创建了一个文件,但是当我使用%cat命令时出现错误:找不到行魔术函数%cat When I type %alias it does not list 'cat' as one of the commands.当我输入 %alias 时,它不会将“cat”列为命令之一。 How can I add it to the list?如何将其添加到列表中?

For command line in ipython, use !对于 ipython 中的命令行,请使用! instead of %而不是%

!ls
!pwd
!cat
...

%alias cat cat , this makes %cat just like typing !cat . %alias cat cat ,这使得%cat就像输入!cat Really only useful if you have standard flags or arguments or more complex commands, eg one of the standard aliases: list files with execute bit set alias lx ls -F -l -G %l | grep ^-..x仅当您有标准标志或参数或更复杂的命令时才真正有用,例如标准别名之一: list files with execute bit set alias lx ls -F -l -G %l | grep ^-..x alias lx ls -F -l -G %l | grep ^-..x

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM