将pylint消息保存到文件中

Dre*_*lee 6 python pylint

是否有内置方法将pylint报告保存到文件中?这样做可能有助于记录项目进度并在进行更改时比较多个文件中的报表元素.

gur*_*lex 11

注意:不推荐使用此选项,它将在Pylint 2.0中删除.

您可以使用--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]
Run Code Online (Sandbox Code Playgroud)

输出的格式被指定的 --output-format=<format>,其中格式可以是选项text,parseable, colorized, msvs (视觉工作室)和html.


Thi*_*ter 7

您可以在shell中重定向其输出.> somefile.txt
如果它写入stderr,请使用2>&1 > somefile.txt

  • @DanCiborowski-MSFT 将其通过管道传输到 `tee somefile` 中;它将写入某个文件并打印到标准输出 (3认同)