I have the following object
class LidarPropertiesField(object):
osversion = ''
lidarname = ''
lat = 0.0
longit = 0.0
alt = 0.0
pitch = 0.0
yaw = 0.0
roll = 0.0
home_el = 0.0
home_az = 0.0
gps = 0
vad = 0
ppi = 0
rhi = 0
flex_traj = 0
focuse = 0
type = 0
range_no = 0
hard_target = 0
dbid = 0
Also I have a dictionary with the same fields, is it possible to compare the object fields with the dictionary fields in a for loop?
Assuming the
dictis calledd, this will check ifLidarPropertiesFieldhas the same values asdfor all keys ind:Alternatively, you can convert the class to a
dictwith something likeand compare with
==.Note the skipping over all class attributes that start with
_to avoid__doc__,__dict__,__module__and__weakref__.