This python module parses (and produces) vCard data as provided in vcf files.
Information about this module can be found here:
Please include this module into your application using the following code:
import jk_vcard
If you export your contacts in your Android smart phone, a VCF file is created. This can serve as an example file and can be parsed using the following code:
with open("contacts.vcf", "r") as f:
data = f.read()
for vCard in VCFParser.parseText(data):
print("-" * 120)
print()
vCard.dump()
print()
print("-" * 120)
If you want to produce a .vcf
file you simply can invoke VCFEncoder.toLines(...)
in order to generate text lines in this format:
vCard = ....
for textLine in VCFEncoder.toLines(vCard):
print(textLine)
If you have a list of VCard
objects you can simple (re)create a .vcf
file like this:
with open("contacts.vcf", "w") as f:
for vCard in myVCardList:
for textLine in VCFEncoder.toLines(vCard):
f.write(textLine + "\n")
This work is Open Source. This enables you to use this work for free.
Please have in mind this also enables you to contribute. We, the subspecies of software developers, can create great things. But the more collaborate, the more fantastic these things can become. Therefore Feel free to contact the author(s) listed below, either for giving feedback, providing comments, hints, indicate possible collaborations, ideas, improvements. Or maybe for "only" reporting some bugs:
- Jürgen Knauth: pubsrc@binary-overflow.de
This software is provided under the following license:
- Apache Software License 2.0