Many StackOverflow questions or answers involve pasting code from iPython into the question/answer.
This results in things like this:
In [32]: print np.random.random([2, 2])
[[ 0.36687173 0.34079422]
[ 0.61761034 0.17372093]]
In [33]: type(np.random)
Out[33]: module
Clearly the 32
and 33
are not interesting to future readers of this question, but how do I go about getting rid of them?
Sometimes I edit them to look like In []:
and I've seen some people whose answers look like In :
Is there a nice way of dealing with this?
Or should they just be left and actually it doesn't matter that much, and I should go and get on with my life?
>>>
) in, to demonstrate that it's an interactive example (i.e. showing inputs and outputs) rather than a standalone code snippet and (hopefully) thereby prevent people trying to run the outputs and getting confused.>>>
are much less controversially a good idea. Often I find myself putting these in manually for the very reason you suggest!