What is a 'NoneType' object?

前端 未结 9 1404
南笙
南笙 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:36

    It means you're trying to concatenate a string with something that is None.

    None is the "null" of Python, and NoneType is its type.

    This code will raise the same kind of error:

    >>> bar = "something"
    >>> foo = None
    >>> print foo + bar
    TypeError: cannot concatenate 'str' and 'NoneType' objects
    

提交回复
热议问题