Our phones contain lots of contacts created before we realised omitting the country code was not an option. Fixing all of these by hand would be punishing. Luckily Google’s libphonenumber can handle that task quite well.
Using python this comes down to an extremely compact piece of code, using vobject and David Drysdale’s python port of libphonenumber. Before you use it though, make sure to set your home country in line 14.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
The script reads contacts from a vCard-file called “input.vcf” (make sure it is placed in your working directory). It outputs the processed contacts to stdout. Typically you would use it like this:
1
|
|
This post was inspired by a discussion on MobileMacs. There also exists a more full-featured app for OS X by Karsten Bruns.