What is a 'NoneType' object?

前端 未结 9 1371
南笙
南笙 2020-11-28 03:12

I\'m getting this error when I run my python script:

TypeError: cannot concatenate \'str\' and \'NoneType\' objects

I\'m pretty sure the \'

9条回答
  •  孤城傲影
    2020-11-28 03:44

    For the sake of defensive programming, objects should be checked against nullity before using.

    if obj is None:
    

    or

    if obj is not None:
    

提交回复
热议问题