ipython
是一个升级版的交互式python命令行工具.
ipython安装
pip install ipython
等到命令执行完成后显示successfully
表示完装成功
在命令提示符下输入ipython
就可以启动ipython了
其与原版python命令行工具不同在于ipython的提示符变成了in和out.
in
为输入命令的地方,out
为命令执行完成后输出的地方
ipython的特点
tab键自动补全一些常用的方法
支持一些系统命令
In [2]: pwd # 显示当前所在目录
Out[2]: '/root'
In [3]: cd .. # 返回当前目录的上一级目录 /
执行系统命令(!)
In [6]: !ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.81.10 netmask 255.255.255.0 broadcast 192.168.81.255 inet6 fe80::a545:8b99:d507:4d0f prefixlen 64 scopeid 0x20<link> ether 00:0c:29:95:d5:31 txqueuelen 1000 (Ethernet) RX packets 12851 bytes 9887304 (9.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7172 bytes 1546188 (1.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 140 bytes 12132 (11.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 140 bytes 12132 (11.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 In [7]: !ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:95:d5:31 brd ff:ff:ff:ff:ff:ff inet 192.168.81.10/24 brd 192.168.81.255 scope global ens33 valid_lft forever preferred_lft forever inet6 fe80::a545:8b99:d507:4d0f/64 scope link valid_lft forever preferred_lft forever In [8]: !cat /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted