How do I identify the blank fields in the csv file in python?

后端 未结 1 363
忘了有多久
忘了有多久 2021-01-20 19:38

I have a csv file with 5 columns:

1, 2312, \"A\", , 20
2, 8383, \"B\", \"UK\", 
3, 3883, , , 45

where the columns represent id, customerId,

相关标签:
1条回答
  • 2021-01-20 19:47

    you want to use not

    0, None, False , '' are all not True

    if not row[4]:
    

    you could also do

    bool(row[4])
    

    which will return False for all the above mentioned values

    0 讨论(0)
提交回复
热议问题