Created
January 31, 2015 18:28
-
-
Save miguelmalvarez/4ef13b9f196c7aa6991e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_csv(file_path, has_header = True): | |
with open(file_path) as f: | |
if has_header: f.readline() | |
data = [] | |
for line in f: | |
line = line.strip().split(",") | |
data.append([float(x) for x in line]) | |
return data | |
def write_csv(file_path, data): | |
with open(file_path,"w") as f: | |
for line in data: f.write(",".join(line) + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment