Skip to content

Instantly share code, notes, and snippets.

@CodeMan99
Created May 12, 2015 17:49
Show Gist options
  • Save CodeMan99/ffb65d362d9d184dcc88 to your computer and use it in GitHub Desktop.
Save CodeMan99/ffb65d362d9d184dcc88 to your computer and use it in GitHub Desktop.
Python 3.4.3+ (3.4:dc10c52c6539, Apr 9 2015, 23:04:55)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> """Hello
... There
...
... I have some blank lines
...
... as well as a trailing newline.
... """.split("\n")
['Hello', 'There', '', 'I have some blank lines', '', 'as well as a trailing newline.', '']
>>> from io import StringIO
>>> StringIO("""Hello
... There
...
... I have some blank lines
...
... as well as a trailing newline.
... """).readlines()
['Hello\n', 'There\n', '\n', 'I have some blank lines\n', '\n', 'as well as a trailing newline.\n']
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment