title: '\n' == 'posix' , '\r\n' == 'nt' (python) is that correct?
body: <p>I'm writing a python(2.7) script that writes a file and has to run on linux, windows and maybe osx.
  Unfortunately for compatibility problems I have to use carriage return and line feed in windows style.
  Is that ok if I assume:</p>
  <pre><code>str = someFunc.returnA_longText()
  with open('file','w') as f:
      if os.name == 'posix':
          f.write(str.replace('\n','\r\n'))
      elif os.name == 'nt'
          f.write(str)    
      
  </code></pre>
  <p>Do I have to considerate an else?
  os.name has other alternatives ('posix', 'nt', 'os2', 'ce', 'java', 'riscos'). Should I use platform module instead?</p>
  <p><strong>Update 1:</strong></p>
  <ol>
  <li><p>The goal is to use '\r\n' in any OS.</p>
  </li>
  <li><p>I'm receiving the str from</p>
  <p>str = etree.tostring(root, pretty_print=True,
  xml_declaration=True, encoding='UTF-8')</p>
  </li>
  </ol>
  <p>I'm not reading a file.<br />
  3. My fault, I should probably check the os.linesep instead?</p>