[IPython-user] save: do not overwerite file but append
Sebastian Fey
sebastian.fey@web...
Sun Apr 26 05:10:48 CDT 2009
hi,
i just want a %save that appends to a file instead of overwriting it.
(btw: it would also be nice to have a command with the same syntax as
save to copy parts of the history to the clipboard)
heres an example of what id like to have:
In [1]: def foo():
...: pass
In [2]: def bar():
...: pass
In [3]: foo()
In [4]: bar()
In [5]: %hist
1:
def foo():
pass
2:
def bar():
pass
3: foo()
4: bar()
In [7]: save s.py 1-2
The following commands were written to file `s.py`:
def foo():
pass
def bar():
pass
In [8]: save s.py 3 -append
The following commands were written to file `s.py`:
foo()
In [9]: save s.py 4
The following commands were written to file `s.py`:
bar()
results in s.py:
def foo():
pass
def bar():
pass
foo()
bar()
Reckoner schrieb:
> what do you want to save exactly? Can you be more specific about
> 'stuff'? Are you trying to save input, output, created variables, or
> what?
>
>
>
> On Sat, Apr 25, 2009 at 1:25 AM, Dill0r <sebastian.fey@web.de> wrote:
>
>> Hi,
>>
>> id like to do the following:
>>
>> test some stuff in the interactive shell, then if i like the behaviour send
>> it to a file.
>> i can do this with save, but it overwrites the file.
>> so i have to save everything at a time or use multiple files.
>>
>> maybe there is a custom save function out there or sth?
>> --
>> View this message in context: http://www.nabble.com/save%3A-do-not-overwerite-file-but-append-tp23197288p23197288.html
>> Sent from the IPython - User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> IPython-user mailing list
>> IPython-user@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>>
>
>
More information about the IPython-user
mailing list