« first day (1007 days earlier)      last day (2359 days later) » 

3:04 PM
i want to check the fieldname in csv file before i write the value and i write this if statement but the compiler never join it. i dont know there is the error

with open(filename,'a') as outfile:
    lineValue = ""
    for sensor, value  in data.items():
        if sensor not in fieldnames:
            # the sensor has not been read, set a neutral value
            lineValue+= 'n/a' + ","
        elif sensor in fieldnames is sensor in data.items():
            v = data[sensor]
            print("v", v)
 
1 message moved from Python
 
Time ,Stromzaehler Leistung L2 [W],Stromzaehler Leistung L3 [W],EG Luftfeuchtigkeit [%],Stromzaehler Spannung L4 [V],EG Temperatur [°C],Stromzaehler Spannung L1 [V],Stecker Energy,EG Helligkeit [Lux],1OG Luftfeuchtigkeit [%],1OG Helligkeit [Lux],Stromzaehler Energie L4 [kWh],Stecker EG Leistung [W],Stromzaehler Strom L4 [A],Stromzaehler Strom L2 [A],Stromzaehler Energie L2 [kWh],Stromzaehler Strom L1 [A],Stromzaehler Energie L3 [kWh],Stromzaehler Energie L1 [kWh],1OG Bewegungsmelder,Stromzaehler Spannung L2 [V],EG Bewegungsmelder,Stecker EG Energie [kWh],1OG Temperatur [°C],Stromzaehler L
you can see that that values dont belong to the wright column
hoy can i fix thia prob?
could someone help me please?
 
3 messages moved from Python
 

« first day (1007 days earlier)      last day (2359 days later) »