Is开发者_如何学Python there any way to change the end of line character for a perl format?
I need to output a file in DOS format and it looks like write does not obey what is in the $\ variable.
I'm assuming you are trying to do this on a non-Windows platform?
You just need a :crlf layer on your filehandle, e.g.:
open FOO, "> :crlf", "foo.txt" or die "error: $!";
format FOO=
hi
there
.
write FOO;
You can apply layers to existing filehandles using binmode:
binmode STDOUT, ":crlf";
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论