2008-11-03 | Paul Boddie | raw annotate files changeset graph | Renamed the StreamWriter.write method to write_content_line. Added support for skipping blank lines when reading content. Added support for opening streams using filenames in the convenience methods, introducing close methods on certain classes in order to support the proper closure of streams after use. |
1 #!/usr/bin/env python 2 3 import codecs, vContent 4 5 f = codecs.open("tests/test.vcf", encoding="utf-8") 6 out = codecs.open("tmp.vcf", "w", encoding="utf-8") 7 try: 8 doc = vContent.iterparse(f) 9 w = vContent.iterwrite(out) 10 for name, parameters, value in doc: 11 print "%r, %r, %r" % (name, parameters, value) 12 w.write_content_line(name, parameters, value) 13 finally: 14 out.close() 15 f.close() 16 17 # vim: tabstop=4 expandtab shiftwidth=4