算命縖子'blog

导航

名字top500字典 各种格式及python脚本

 

原文件名字top500

链接: https://pan.baidu.com/s/1cv0jPYb1-EBceoZz3QNvgg 密码: bat5


中文名字

链接: https://pan.baidu.com/s/1O3j0NxWrEncXlFZ1Li8IpQ 密码: xj7n

全拼 比如:zhangwei

 

链接: https://pan.baidu.com/s/1q_sZ_FlYu9JCkdSYywskog 密码: t72p

姓全拼 名取首字母 比如:zhangw

 

链接: https://pan.baidu.com/s/1xzQscNrVNBMpsyBqvrWAYw 密码: kdga

全部取首字母 比如:zw

链接: https://pan.baidu.com/s/1IepYUv9pY3O3gTROMlcDhg 密码: 62j5

全部的下载链接
链接: https://pan.baidu.com/s/1JWbAMZ3x7we2K9coookaxg 密码: b6r8


================================================================

 

同时用python3写了个脚本

读取name.txt的中文名字

 

#!/usr/bin/env python
# -*- conding:utf-8 -*- 
import re
from xpinyin import Pinyin

def name():
    mz=[]
    with open('name.txt','r') as f:
        for i in f.readlines():
            #res=re.compile(r'[\u0391-\uFFE5]+') #匹配中文
            #date = res.findall(i)
            mz.append(date)
            #print(date)
    return mz




def zhangwei(date): #zhangwei
    with open('zhangwei.txt', 'a') as f:
        p = Pinyin()
        for i in date:
            pinyin =p.get_pinyin(i[0])
            res = re.compile(r'(\w)')
            pydate = res.findall(pinyin)
            for i in pydate:
                f.write(i)
            f.write('\n')

def zhangw(date):  #zhangw
    with open('zhangw.txt', 'a') as f:
        p = Pinyin()
        for i in date:
            pinyin = p.get_pinyin(i[0])
            res = re.compile(r'(.*?)-(.).*?-(.)|(.*?)-(.)')
            pydate = res.findall(pinyin)
            for i in pydate[0]:
                f.write(i)
            print('\n')
            f.write("\n")

def zw(date):  #zw
    with open('zw.txt', 'a') as f:
        p = Pinyin()
        for i in date:
            pinyin = p.get_pinyin(i[0])
            res = re.compile(r'(.).*?-(.).*?-(.)|(.).*?-(.)')
            pydate = res.findall(pinyin)
            for i in pydate[0]:
                f.write(i)
            print('\n')
            f.write("\n")

date=name()
zhangwei(date)
zhangw(date)
zw(date)

 

posted on 2018-06-03 20:39  算命縖子  阅读(3293)  评论(1编辑  收藏  举报