【python – Dos2unix在尝试静音命令时无法正常工作】教程文章相关的互联网学习教程文章

python – Dos2unix在尝试静音命令时无法正常工作【代码】

我这样在Python中调用dos2unix:call("dos2unix " + file1, shell=True, stdout=PIPE)但是为了使Unix输出静音,我这样做了:f_null = open(os.devnull, 'w') call("dos2unix " + file1, shell=True, stdout=f_null , stderr=subprocess.STDOUT)这似乎不起作用.该命令不再被调用为我在file1上对file2执行的差异(做了一个diff -y file1 file2 | cat -t并且可以看到行结尾没有改变). file2是我正在比较file1的文件.它具有Unix行结尾,因...