PythonでNonetypeを判断する方法

1099 ワード

転載は出典を明記してください。http://blog.csdn.net/dongdong9223/article/details/85339387 この記事は「私は干潟のブログです。」
Ingredints:
  • Python:Python 3.6.6(Python Downloads)
  • pythonに現れます
    Type Error:‘NoneType’object is not subscriptable
    のエラー時は判定が必要だと説明し、「NoneType」を判断する時は「is None」をそのまま使ってもいいです。
    if text is None:
        print('test is ' + None)
    else:
        print('test is not ' + None)
    
    参考:
    Pythonの中のNonetypeのタイプはどう判断しますか?