Can Python fix vcard files?
skip at pobox.com
skip at pobox.com
Mon Oct 13 21:38:07 EDT 2008
Dotan> One question, though, is that code unicode-safe in the event that
Dotan> there are unicode characters in there?
Off the top of my head I don't know (and it may well vary by Python
version). Just leave out the dangerous parts of the loop to check:
for f in glob.glob('*.vcf'):
# corrupt data
uncooked = open(f, 'rb').read()
# fix it
cooked = uncooked.replace('\n ', '')
# and write it to the bit bucket
open(os.path.devnull, 'wb').write(cooked)
Skip
More information about the Python-list
mailing list