Kia ora folks
All fair questions. I didn't articulate well in the post. I don't care if it's single or double quotes, only that my column one data is formatted as text and not a number, so that I can do a join to another database, where the meshblock field is text and includes the leading zeros. The csv.reader certainly turns everything into text which is why all my code to date has never tripped over this, as even reading from the secondary database comes in as text. However, as I am learning, whenever the csv.writer writes this to a text or csv file, it's formatted numeric, even when the input was text and even when I've converted it to string as in the above example.
Here is a sample of the rf1 input, as cut and pasted from the text editor. (That way you see the quotes where things are formatted as text) In a spreadsheet programme, all the leading zeros get truncated as the format is numeric for column one, and this format issue is preventing the join at the next step in my work:
"MB_JOIN","HSECNT06","POP_06","PV","PVPH","GED_07"
0000100,0,3,3,0,34
0000200,24,87,2,0.08,34
0000300,24,75,7,0.29,34
0000502,12,24,1,0.08,34
0000600,15,45,2,0.13,34
0000700,24,66,5,0.21,34
0000800,45,150,3,0.07,34
0000900,9,27,2,0.22,34
0001000,27,63,7,0.26,34
It seems laughably simple but it has tripped me up for many an hour yesterday! If I could just get column one looking like this:
"0000100" or this:
'0000100' then Bob's my uncle!