adding '+' to all the numbers as a prefix (numbers are stored in a csv file) using a python script -
goal
all numbers in csv file exported hotmail stored 91123456789
whereas complete call need dial +91123456789
. these contacts converted batch of vcf files , exported phone. want add + contacts @ beginning.
approach
write python script can indefinite number of contacts.
pre-conditions
none of numbers in csv file have + in them.
problem
(a) there posibility number may have 91
in like: +919658912365
. makes adding plus difficult.
explanation:i adding problem, if 91 there @ beginning of number can add simple checking 2 consecutive digits , if match 91
can add + else don't need add +
, can move on next pair of digits.
(b) fields seprated comma's. want add +
prefix in front of field has header mobile
, not in other field set of digits 91
may appear(like in landline numbers or fax numbers)
research
i tried excel, process take unreasonable amount of time(like 2 hours!)
specs
i have 400 contacts. windows xp sp 3
please me solve problem.
something below??
import csv row in csv.reader(['num1, 123456789', 'num2, 987654321', 'num3, +23456789']): phonenumber = row[1].strip() if not phonenumber.startswith('+'): phonenumber = '+' + phonenumber print phonenumber
Comments
Post a Comment