A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ipython/ipython/issues/1545/ below:

trailing newline not preserved in splitline ipynb · Issue #1545 · ipython/ipython · GitHub

We use splitlines() on probable multi-line blocks for nicer ipynb files. But there is a small ambiguity, in that 0 or 1 trailing newlines produce identical output. The only place this really matters is multiple sequential stdout messages.

For instance, run a notebook with the following cell:

for i in range(5):
    print i,
    sys.stdout.flush()

print '--'

for i in range(5,10):
    print i
    sys.stdout.flush()

Then save & reload. The new output will have 56789 on one line, instead of on 5 lines like the original output.

PR #1480 now contains a fix, which is replacing item.splitlines() with (item+'\n').splitlines(), which is the true inverse of '\n'.join(lines).


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4