I am working on Windows 11 with python3 from activestate and I want to write a python script which prints shell commands to stdout which then could be run on Linux or on windows with cygwin.
Printing to stdout on Windows automatically converts \n to \r\n which in my case is really annoying.
I know that I can pipe the stdout to dos2unix or open a file in my python script and write to it with newline set to \n.
What I am looking for though is a way to tell python that I want to print to stdout without any automagic conversion of \n into \r\n.
Is there an easy way to achieve this?
Asked
Active
Viewed 21 times
0

user333869
- 549
- 1
- 4
- 13
-
Offhand I don't think there's a way to do this, I hope for your sake I'm wrong. – Mark Ransom Jul 10 '23 at 16:46