Re: Can Python fix vcard files?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • skip@pobox.com

    Re: Can Python fix vcard files?


    DotanOne question, though, is that code unicode-safe in the event that
    Dotanthere 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('*.vc f'):
    # corrupt data
    uncooked = open(f, 'rb').read()
    # fix it
    cooked = uncooked.replac e('\n ', '')
    # and write it to the bit bucket
    open(os.path.de vnull, 'wb').write(coo ked)

    Skip
Working...