CSV read is adding spaces - How to Stop

Hi there forum, can someone help me I'm trying to execute a CSV file to control / change my NeoPixels all connected to my Raspberry Pi.

When I read out the CSV file each line bar the last has a space added to the end of the line.

So the lines with a space at the end fail to be actioned, only the last one is actioned.

Any pointers on what I'm doing wrong would br greatly appreciated.

I've dumped my workings so far on GitHub https://github.com/Brewj/NeoPixels

Merry Christmas!

Maybe you are using windows line endings \r\n rather than plain \n ?
On github raw file view does look like an extra char there.
Either edit the file - or add a function to .trim() off the whitespace.

Thanks for the response dceejay, i'm generating the csv file in excel i've tried MS-DOS, UTF-8 and regular CSV, sadly non of these options resolved it however when i created the file in Bbedit and saved it with Unix line endings result it works thank you!

Working code now on GitHub

1 Like