- # convert the lines to a Python list, pickle it and optionally compress the result.
- lines = []
- for line in data:
- if line[0] == "\"":
- # the line is typically (but not always):
- # [quote] <data> [quote][comma][newline]
-
- # chop one char from the front
- line = line[1:]
-
- # now find the final quote and truncate there
- quote = string.rfind(line, "\"")
-
- # and append the remaining data to our list
- lines.append(line[:quote])
-
-
- # pickle, crunch and convert it to a form suitable for embedding in code
- data = cPickle.dumps(lines)