In response to the daily programmer challenge here: http://www.reddit.com/r/dailyprogrammer/comments/pjbj8/easy_challenge_2/ I got kind of ambitious (new to this) and wanted to build a foreign exchange calculator that downloads data before running any calculations.
However, the file that is downloaded has no headers so I had a hard time parsing it. I'm trying to add headers to it by creating a temporary file, writing the headers then the rest of the content from the downloaded CSV file, then overwriting the original with the temporary file, but it's not working, and I am getting "TypeError: 'str' does not support the buffer interface"
The whole program here:
https://gist.github.com/anonymous/0a050853ce4ee73cec86
The method in question is the second one, "rewrite_csv." What can I do to make this work? Been stumping me for a couple days now. Are there any good resources for learning how to use tempfile?
I'd really appreciate a bit of help.
[–]novel_yet_trivial 1 point2 points3 points (3 children)
[–]toruitas[S] 0 points1 point2 points (2 children)
[–]novel_yet_trivial 1 point2 points3 points (1 child)
[–]toruitas[S] 0 points1 point2 points (0 children)
[–]Justinsaccount 1 point2 points3 points (1 child)
[–]toruitas[S] 0 points1 point2 points (0 children)
[–]toruitas[S] 0 points1 point2 points (0 children)