import csv
from phone import Phone

p = Phone()
path = '/Users/quping/Downloads/'
with open(path + '号码归属地-20211027.csv', 'w') as fw:
    cw = csv.writer(fw, quoting=csv.QUOTE_NONNUMERIC)
    with open(path + '号码归属地.csv') as fr:
        cr = csv.reader(fr)
        for name, number in cr:
            if number.isdigit():
                info = p.find(number)
                if not info:
                    continue
                print(name, info['phone'], info['province'], info['city'], info['phone_type'])
                cw.writerow([name, info['phone'], info['province'], info['city'], info['phone_type']])

python csv 手机号码 归属地



Copyright © 2006-2021 quping.com, All rights reserved. 鲁ICP备09092435号-1

QQ 微信