版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dongdong9223/article/details/85339387
转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/85339387
本文出自【我是干勾鱼的博客】
Ingredients:
- Python:Python 3.6.6(Python Downloads)
python中出现:
TypeError: ‘NoneType’ object is not subscriptable
的错误时说明需要进行判断,而对 ‘NoneType’ 进行判断时直接使用‘is None’即可,如下:
if text is None:
print('test is ' + None)
else:
print('test is not ' + None)