朋友想要个随机手机号的excel,python写法比java简单些
不多说 直接上代码
import xlwt
import random
from datetime import datetime
style0 = xlwt.easyxf('font: name Times New Roman, color-index red, bold on', num_format_str='#,##0.00')
style1 = xlwt.easyxf(num_format_str='D-MMM-YY')
wb = xlwt.Workbook()
ws = wb.add_sheet('A Test Sheet')
ws.write(0, 0, "姓名", style0)
ws.write(0, 1, "国家", style0)
ws.write(0, 2, "手机号", style0)
ws.write(0, 3, "单位", style0)
for i in range(1, 10000, 1):
xing = '赵钱孙李周吴郑王金木水火土石天地日月星光江河湖海田泉风霜雨雪雷电山岭崖谷丘岩云雾浪'
ming = '人间四月芳菲尽山寺桃花始胜开金木水火土石天地日月星光江河湖海田泉风霜雨雪雷电山岭崖谷丘岩云雾浪'
x = random.choice(xing)
m = "".join(random.choice(ming) for i in range(1, 3))
name = x + m
prelist = ["130", "131", "132", "133", "134", "135", "136", "