diff options
Diffstat (limited to 'pm_data_analysis/pmserialize.py')
| -rw-r--r-- | pm_data_analysis/pmserialize.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pm_data_analysis/pmserialize.py b/pm_data_analysis/pmserialize.py new file mode 100644 index 0000000..14e0f3b --- /dev/null +++ b/pm_data_analysis/pmserialize.py | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #!/usr/bin/env python | ||
| 2 | |||
| 3 | import cPickle | ||
| 4 | import csv | ||
| 5 | |||
| 6 | # http://en.wikipedia.org/wiki/Picolit | ||
| 7 | def pickl_it(vector, filename): | ||
| 8 | f = open(filename, 'w') | ||
| 9 | cPickle.dump(vector, f) | ||
| 10 | f.close() | ||
| 11 | |||
| 12 | def unpickl_it(filename): | ||
| 13 | f = open(filename, 'r') | ||
| 14 | vector = cPickle.load(f) | ||
| 15 | f.close() | ||
| 16 | return vector | ||
| 17 | |||
| 18 | # FIXME the one char one comma format from csv | ||
| 19 | # is not very "human readable" :| | ||
| 20 | def cvs_it(file, string): | ||
| 21 | wr = csv.writer(file) | ||
| 22 | wr.writerow(string) | ||
| 23 | |||
| 24 | def uncvs_it(file, string): | ||
| 25 | return None | ||
