是否有一种内置的方法可以将pylint报告保存到文件中?似乎这样做很有用,可以记录项目进展并在多个文件之间比较报告的元素随着更改的进行。
你可以使用命令行选项 --file-output=y
。引用手册页面的描述:
--files-output=<y_or_n>
Put messages in a separate file for each module / package speci‐
fied on the command line instead of printing them on stdout.
Reports (if any) will be written in a file name
"pylint_global.[txt|html]". [current: no]
输出格式由 --output-format=<format>
选项指定,其中 format 可以是 text
、parseable
、colorized
、msvs
(visual studio)和 html
。
您可以使用 > somefile.txt
将其输出重定向到您的shell环境中。
如果它将内容写入了 stderr,则可以使用2>&1 > somefile.txt
。
tee somefile
中,它将写入到somefile文件并同时打印到标准输出。 - ThiefMaster