Skip to content

Instantly share code, notes, and snippets.

@xrl1
xrl1 / xml_to_vcf_converter.py
Created April 6, 2017 22:04
converts contacts from an xml file to a vcf file to make it importable in android
import xml.etree.ElementTree as ET
import argparse
import sys
def unicode_to_vcf_str(unicode_str):
if type(unicode_str) == type(None):
return ''
hex_list = ['=' + i.encode('hex').upper() for i in unicode_str.encode('utf-8')]
return ''.join(hex_list)