Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>... but this doesn't handle "mixed" text-files of utterly confused conventions (Yes, they still exist!)</p> </blockquote> <p>Actually it should work fine:</p> <pre><code>&gt;&gt;&gt; s = 'hello world\nline 1\r\nline 2' &gt;&gt;&gt; s.splitlines() ['hello world', 'line 1', 'line 2'] &gt;&gt;&gt; '\n'.join(s.splitlines()) 'hello world\nline 1\nline 2' </code></pre> <p>What version of Python are you using?</p> <p><strong>EDIT:</strong> I still don't see how <code>splitlines()</code> is not working for you:</p> <pre><code>&gt;&gt;&gt; s = '''\ ... First line, with LF\n\ ... Second line, with CR\r\ ... Third line, with CRLF\r\n\ ... Two blank lines with LFs\n\ ... \n\ ... \n\ ... Two blank lines with CRs\r\ ... \r\ ... \r\ ... Two blank lines with CRLFs\r\n\ ... \r\n\ ... \r\n\ ... Three blank lines with a jumble of things:\r\n\ ... \r\ ... \r\n\ ... \n\ ... End without a newline.''' &gt;&gt;&gt; s.splitlines() ['First line, with LF', 'Second line, with CR', 'Third line, with CRLF', 'Two blank lines with LFs', '', '', 'Two blank lines with CRs', '', '', 'Two blank lines with CRLFs', '', '', 'Three blank lines with a jumble of things:', '', '', '', 'End without a newline.'] &gt;&gt;&gt; print '\n'.join(s.splitlines()) First line, with LF Second line, with CR Third line, with CRLF Two blank lines with LFs Two blank lines with CRs Two blank lines with CRLFs Three blank lines with a jumble of things: End without a newline. </code></pre> <p>As far as I know <code>splitlines()</code> doesn't split the list twice or anything.</p> <p>Can you paste a sample of the kind of input that's giving you trouble?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload