excel中批量指生成身份证号的函数:
=INDEX({11;12;13;14;15;21;65;22;23;31;32;33;34;35;36;37;41;42;43;44;45;46;50;51;52;53;54;61;62;63;64},RAND()*31+1)&TEXT(RAND()*9999,"0000")&TEXT(24838+INT(RAND()*8036),"yyyymmdd")&TEXT(INT(RAND()*9999),"0000")
或者
=41132519960606&RANDBETWEEN(1000,9999)
excel中批量指生成手机号的函数:
=13&RANDBETWEEN(100000000,999999999)
随机生成汉字:
=CHAR((INT(16+RAND()*38+160)*256)+INT(94*RAND())+160)
生成姓名示例,李姓开头
="李"&CHAR((INT(16+RAND()*38+160)*256)+INT(94*RAND())+160)&CHAR((INT(16+RAND()*38+160)*256)+INT(94*RAND())+160)
批量修改文件名的python代码:
#coding=utf-8
import sys, string, os, shutil
#输入目录名和前缀名,重命名后的名称结构类似prefix_0001
def RenameFiles(srcdir, prefix):
srcfiles = os.listdir(srcdir)
index = 1
for srcfile in srcfiles:
srcfilename = os.path.splitext(srcfile)[0][1:]
sufix = os.path.splitext(srcfile)[1]
#根据目录下具体的文件数修改%号后的值,"%04d"最多支持9999
destfile = srcdir + "//" + prefix + "_%04d"%(index) + sufix
srcfile = os.path.join(srcdir, srcfile)
os.rename(srcfile, destfile)
index += 1
srcdir = "C:/Users/ceshi/Desktop/sample/Demo/asasa"
prefix = "img"
RenameFiles(srcdir, prefix)