加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
SeqDBCreator.py 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
aeon-nexus 提交于 2016-04-12 15:50 . Added files via upload
import random
itemSet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
DATASET_LIMIT = 100
ELEM_LIMIT = 15
#ITEM_LIMIT = len(itemSet)
ITEM_LIMIT = 8
outPath = 'DATASET6.csv'
def main():
with open(outPath,'w') as outFile:
for i in range(0,DATASET_LIMIT):
elemLimit = random.randrange(1,ELEM_LIMIT+1,1)
outString = ""
for j in range(0,elemLimit):
itemLimit = random.randrange(1,ITEM_LIMIT+1,1)
outElem = ""
for k in range(0,itemLimit):
while(True):
item = random.choice(itemSet)
if item not in outElem:
outElem = outElem + item
break
outString = outString + outElem
if j != elemLimit - 1:
outString = outString + ","
if i != DATASET_LIMIT - 1:
outString = outString + "\n"
outFile.write(outString)
outFile.close()
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化