line into ipythonand line breaks are treated as this means that if you paste code with an indented block and there is blank lineipython will think that the indented block is over once the next line in the block is executedan indentationer ror will be raised for example the following codex if + will not work if simply pastedin [ ] in [ ] in [ ]if + in [ ] indentationerrorunexpected indent if you want to paste code into ipythontry the %paste and %cpaste magic functions as the error message suggestswe should instead use the %paste and %cpaste magic functions %paste takes whatever text is in the clipboard and executes it as single block in the shellin [ ]%paste if + #-end pasted text -depending on your platform and how you installed pythonthere' small chance that %paste will not work packaged distributions like epdfree (as described in in the introshould not be problem %cpaste is similarexcept that it gives you special prompt for pasting code intoin [ ]%cpaste pasting codeenter '--alone on the line to stop or use ctrl- : : :if ipython basics www it-ebooks info