Advertisement
DecaK

Untitled

Jun 26th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. def vc_generator(data_dict, keys_dict={'last_name middle_name first_name title': 'N:','address': 'ADR:', 'email': 'EMAIL;INTERNET:', 'phone_number': 'TEL:'}):
  2. returnString = "BEGIN:VCARD\n"
  3. for i in keys_dict:
  4. final_str = ";".join(data_dict[key] if key in data_dict else '' for key in i.split(' '))
  5. if not len(final_str):
  6. continue
  7. returnString = returnString + "{0}{1}\n".format(keys_dict[i], final_str)
  8. return returnString + "END:VCARD";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement