I read my timesteps from a netcdf file:
timesteps = ncfile.variables['time']
Now I would like to know whether some given date (say, June 23th) exists in that list. If it does, I want to omit it. The netcdf file contains arbitrary dates.
I have no clue how to do this in python. I'm new to python and my programming experience in python is best described as in https://xkcd.com/1513/ yet I have no time to follow a course, so any help would be greatly appreciated.
Thanks!
Ok, this is not good style but it might get you what you want. Assuming your times are strings and you are confident that plain string comparison would work for you, you could do something like this:
A better way of doing this is to parse your timesteps times (whether string or number) and turn into a datetime.date objects and compare against datetime.date objects you create in code.