What is a 'NoneType' object?

前端 未结 9 1406
南笙
南笙 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 04:00

    NoneType is simply the type of the None singleton:

    >>> type(None)
    
    

    From the latter link above:

    None

    The sole value of the type NoneType. None is frequently used to represent the absence of a value, as when default arguments are not passed to a function. Assignments to None are illegal and raise a SyntaxError.

    In your case, it looks like one of the items you are trying to concatenate is None, hence your error.

提交回复
热议问题