在jupyter notebook里运行shell命令的方式是:在shell命令前加一个!,就可以在cell里运行,这样你就可以看到你的工作文件夹里有哪些数据集。
#把ls命令的输出导入到fib.py这个文件
In [77]: !ls -l > fib.py
In [78]:!cat fib.py
total 688464
-rw-r–r– 1 eyeglasses root 70242 May 11 2017 1.csv
-rw-r–r– 1 eyeglasses root 236171 May 12 2017 600641.csv
-rw-r–r– 1 eyeglasses root 0 Sep 19 15:39 600642
-rw-r–r– 1 eyeglasses root 54473 May 11 2017 642.csv
-rw-r–r– 1 eyeglasses root 366169 Sep 20 15:26 A600642.csv
drwxr-xr-x 4 eyeglasses root 4096 Sep 4 14:03 abu
drwxr-xr-x 3 eyeglasses root 4096 Jun 27 2017 alarm
-rw-rw-r– 1 eyeglasses eyeglasses 5929 Apr 7 2017 alltickers_ohlc.csv
drwxrwxr-x. 15 eyeglasses eyeglasses 4096 Nov 7 16:55 anaconda3
当然你也可以用%pycat fib.py来看,%符号是jupyter notebook里的魔术命令,而!符号是执行shell的命令,如果还不懂,多看上面的例子。
网友评论