ipython

M

Mark Lawrence

using IPython, is there any way of recording the commands I have entered?

I believe ipython automatically stores the commands you enter.
Searching for ipython+command+history should get you more detail than I
can offer :)
 
G

greymausg

I believe ipython automatically stores the commands you enter.
Searching for ipython+command+history should get you more detail than I
can offer :)

What I was thinking of is like a perl Module WWW::Mechanize::Shell,
which has a script included, "wwwshell.pl", which allows you to
enter commands to explore web sites, then enter "source x",
and it will save the commands you have used to a script, 'x'.
This can be run straight to do what you want, say scraping a
web site.
 
P

Peter Otten

greymausg said:
using IPython, is there any way of recording the commands I have entered?

Did you ever enter

?

in ipython?

In [1]: a = float(raw_input("a? "))
a? 1

In [2]: b = float(raw_input("b? "))
b? 2

In [3]: ab = a + b

In [4]: c = ab*ab

In [5]: print c
9.0

In [6]: In[1:3]
Out[6]: u'a = float(raw_input("a? "))\nb = float(raw_input("b? "))\n'

In [7]: %macro abc 1:6
Macro `abc` created. To execute, type its name (without quotes).
Macro contents:
a = float(raw_input("a? "))
b = float(raw_input("b? "))
ab = a + b
c = ab*ab
print c


In [8]: abc
------> abc()
a? 2
b? 2
16.0

In [14]:
 
G

greymausg

What I was thinking of is like a perl Module WWW::Mechanize::Shell,
which has a script included, "wwwshell.pl", which allows you to
enter commands to explore web sites, then enter "source x",

Sorry "script x"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top