Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nice copying from Python Interpreter

Tags:

python

When I am working with a Python Interpreter, I always find it a pain to try and copy code from it because it inserts all of these >>> and ...

Is there a Python interpreter that will let me copy code, without having to deal with this? Or alternatively, is there a way to clean the output.

Additionally, sometimes I would like to paste code in, but the code is indented. Is there any console that can automatically indent it instead of throwing an error?

Related

  • Why can I not paste the output of Pythons REPL without manual-editing?
like image 925
Casebash Avatar asked Aug 30 '09 02:08

Casebash


People also ask

How do you paste into Python interpreter?

To copy text, just select it and hit Ctrl-C (Command-C on a Mac). If the highlight marking the selection disappears, that's normal and it means it's worked. To paste, use Ctrl-V (Command-V on a Mac).

What does copy () do in Python?

Definition and Usage. The copy() method returns a copy of the specified list.


2 Answers

IPython lets you show, save and edit your command history, for example to show the first three commands of your session without line numbers you'd type %hist -n 1 4.

like image 158
Ants Aasma Avatar answered Sep 30 '22 20:09

Ants Aasma


WingIDE from Wingware will let you evaluate any chunk of code in a separate interpreter window.

like image 31
Arkady Avatar answered Sep 30 '22 18:09

Arkady