2012-08-02 74 views
6

有沒有辦法執行ipython腳本?我的意思並不是Python腳本,而是用簡單的語法,因爲它會被進入的IPython Shell我可以執行ipython腳本嗎?

+0

HTTP: //whathaveyoutried.com/ – Marcin 2012-08-02 18:18:50

回答

12

肯定,只是IPython中使用Python運行它們作爲你的一個普通的Python腳本:

$> echo '%time print "hello, world"' > script.ipy 
$> ipython script.ipy 
hello, world 
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s 
Wall time: 0.00 s 
+6

關鍵是'.ipy'的擴展名,否則它會嘗試將它作爲普通的python文件運行。 – 2012-08-04 11:39:03

相關問題