I format the string (when overloading the str statement), and I do not want to use the raw \ n or \ r \ n tags. Have a python cross platform id like std :: endl in c ++?
I am trying to do this but have not found an answer.
How about using os.linesep ? It contains the appropriate line separator for your OS:
os.linesep
>>> import os >>> os.linesep '\n' >>> print "line one" + os.linesep + "line two" line one line two
No. Use \n . And in C ++, std::endl is nothing more than "\n" << std::flush , and it is no more cross-platform, whatever that means. It is only slower, as it forces to rinse.
\n
std::endl
"\n" << std::flush
There is nothing wrong with using \n - why don't you want to use it? A cross-platform problem only makes sense when writing to files, and a file object will take care of this for you.
file
Source: https://habr.com/ru/post/1383866/More articles:Filter in openerp - openerpAndroid popup menu with icons (similar to Google Map app version 6) - androidGoogle Charts "don't meet Control or Visualization specifications" - google-visualizationDebugging maven tests with netbeans 6.9.1? - javaorg-mode cannot edit C source code - emacsHow to call user-extensions.js in Selenium WebDriver - javaCreating an abstract collection from an abstract collection - javahow to send contents to a list from server in twisted python? - pythonUsing the typedef name in the developed specifier - c ++How to update a graph or chart dynamically in android? - androidAll Articles