[Tutor] How to change the values in python code?

Mats Wichmann mats at wichmann.us
Mon Nov 7 18:30:47 EST 2022


On 11/7/22 16:17, Alan Gauld via Tutor wrote:

>> Line1340: -1.97, 0.84, 10.35, -0.10, -0.01, -0.01, 24.16, 48040
>> Line1341: -1.97, 0.86, 10.35, -0.10, -0.01, -0.01, 24.16, 48075
>>
>> ****this is where the split needs to happen where Last<previous
>>
>> Line1342: -2.16, 0.54, 10.25, -0.10, -0.00, -0.01, 24.18, 493
> 
> And here it is 1, 2, 4 and 7.
> 
> Again, what makes this row different to the others?

I'm going to guess that the last field is something like "seconds since 
start of new processing period" (like midnight), and so the idea is to 
split the log into individual days.

The original example did call out the last field so pretty sure that's 
the one that's of interest:

     last=int(x[7])

This is way more readable if you unpack the split into named variables - 
then you don't have code which relies on magical but undocumented 
indices into a list. Pcessing things that look like csv are always 
fraught with field recognition problems unless someone is nice enough to 
emit the column names too.




More information about the Tutor mailing list