Strip prompts even if the prompt isn't present on the first line.

Users (including me) often copy and paste examples from just after the first
prompt. This checks for prompts in the first two lines of a block, but if they
aren't found there, it will ignore prompt-like prefixes in later lines, to
minimise interference with multi-line strings etc.

Closes gh-3206
Merge pull request #3323 from takluyver/strip-prompts

Strip prompts even if the prompt isn't present on the first line.

Users (including me) often copy and paste examples from just after the first prompt. This checks for prompts in the first two lines of a block, but if they aren't found there, it will ignore prompt-like prefixes in later lines, to minimise interference with multi-line strings etc.

This fixes both incoming copies (transformed before running code) and outgoing (copied from the Qt console).

Closes #3206