相关疑难解决方法(0)

隐藏一些可能没有成员的Pylint错误

以下Python片段代码通过以下方式分析Pylint:

if type(result) is array.array:
    read = result.tobytes()
Run Code Online (Sandbox Code Playgroud)

...最后一行出现以下错误:

E:401,22: Instance of 'int' has no 'tobytes' member\ 
 (but some types could not be inferred) (maybe-no-member)
Run Code Online (Sandbox Code Playgroud)

result变量是从外部函数接收.如何更改(更正)代码以使Pylint理解?或者我怎么能告诉它函数的结果可以有除int之外的其他类型?或者我怎么能告诉它忽略那条特定的线?(我赞成按此顺序回答问题)

python pylint python-3.4

15
推荐指数
1
解决办法
1万
查看次数

标签 统计

pylint ×1

python ×1

python-3.4 ×1