How to exclude NoneType class while reading string in Python

后端 未结 2 734
渐次进展
渐次进展 2021-01-29 08:54

I have a list that is pulled into python from Google Sheets. Some of the cells are empty and return a value of None.

I checked the class type for these \'None\' values a

2条回答
  •  一生所求
    2021-01-29 09:56

    for i, val in enumerate(some_list):
        if val is not None:
            print (i,val)
    

    If you wish to skip None and blank values:

    for i, val in enumerate(some_list):
        if val is not None and val != "":
            print (i,val)
    

提交回复
热议问题