相关疑难解决方法(0)

在Python中安全解除引用

Groovy有一个很好的安全解除引用运算符,这有助于避免NullPointerExceptions:

variable?.method()
Run Code Online (Sandbox Code Playgroud)

method只有在variable没有的情况下才会被调用null.

有没有办法在Python中做同样的事情?或者我必须写if variable: variable.method()

python null groovy nullpointerexception

13
推荐指数
3
解决办法
5914
查看次数

标签 统计

groovy ×1

null ×1

nullpointerexception ×1

python ×1