Python command line: ignore indentation Python command line: ignore indentation python python

Python command line: ignore indentation


In such case, I use following trick (prepend if 1:):

>>> if 1:...     print 1...1


The ipython %cpaste function will allow you to paste indented code and work properly:

In [5]: %cpastePasting code; enter '--' alone on the line to stop or use Ctrl-D.:        print "This is my function called with value 1.":        print "Done.":^D<EOF>This is my function called with value 1.Done.


Can you just avoid copying the tabs?

Notepad++ and Visual Studio allow rectangular selection by holding Shift + Alt when selecting text.

Whatever editor you use probably allows that as well.

Yes, this doesn't answer your question as asked, but maybe it will solve your problem.

edit:

gvim allows rectangular selections that includes all line contents by Ctrl-l v Ctrl-q $ Shift-Down or Up arrow.Thanks to Joel for clarifying this.

This link explains and provides other alternatives within vim: http://vim.wikia.com/wiki/Add_trailing_blanks_to_lines_for_easy_visual_blocks