Since today is 30/9/2023 but the video is so usefull for me just becuase it actually help me to figure out how to done my assignment. Thank you so much for the effort
I'd check for the length of the row first, and decide whether or not to skip. Or... use a try-catch block to catch an error from an empty row, and then decide how to process it.
Hi Brandon, your tutorial was very useful but I've been having issues with a CSV file, particularly when printing out the cells in the last column of each row within my CSV file. It's like the last cell in the previous row is attached to the first cell in the next row of the file. The cell contents print in the correct position but they print simultaneously as if they are joined together. For instance, let's say I have a CSV file with the contents: 7,7,7,7 3,3,3,3 When printing each number, the first three sevens in the first row print individually but the last seven prints with the first three in the next row, like so: 1st pass 7, 2nd pass 7,7, 3rd pass 7,7,7, 4th pass 7,7,7,7 3, My program aims to store each element individually and cannot do so until I figure out how to separate the last and first lines. Do you have any idea on how to solve this?
If it's a one to many relationship, I would split the "many" side into a separate file that is foreign-keyed back to the main cars file, using a unique identifier. Alternatively, you could do it all in one file if you have an additional field before the mpgs: a field that tells you how many MPGs follow. That way, you know how many mpgs to expect, and you read and parse each of them, then continue with the next field.
So there isn't a way to have a flexible field that could hold more than one value? Say we input the amount of cash transactions a business has in one day.