View Single Post
  #5  
Old 08-17-2016, 11:21 AM
vysh vysh is offline
Registered User
 
Join Date: Oct 2014
Posts: 40
I assumed new lines would be converted automatically into their os-specific versions when putting them into the clipboard just as it is the case with open():

https://docs.python.org/2/library/functions.html#open:
Quote:
The default is to use text mode, which may convert '\n' characters to a platform-specific representation on writing and back on reading.

However it looks like they do not get converterd, so you have to use code like:
Code:
    if os.name == 'nt':
        final_results = final_results.replace('\n', '\r\n')

    crt.Clipboard.Text = final_results
Reply With Quote