mirror of
https://gitee.com/willfree/folder-file-manager.git
synced 2026-06-07 16:39:45 +08:00
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
import random
|
|
import FileManager
|
|
|
|
# 生成一个人名
|
|
def generatorPersonName():
|
|
dataPath = '.\\Data\\PersonName\\HistoryName.txt'
|
|
with open(dataPath, 'r+', encoding='utf-8') as f:
|
|
lines = f.readlines()
|
|
lineslen= len(lines)
|
|
luckyNum=random.randint(0,lineslen-1)
|
|
print(lines[luckyNum].split()[0])
|
|
return lines[luckyNum].split()[0]
|
|
|
|
# 根据所属领域,生成一个实验室名称
|
|
def generatorLabNameBySubjectArea(subjectArea):
|
|
dataPath = '.\\Data\\Labs\\'
|
|
labnameList = FileManager.readExcelByCol(dataPath+subjectArea+"实验室.xlsx", 0)
|
|
luckyNum=random.randint(0, len(labnameList)-1)
|
|
print(labnameList[luckyNum]+"实验室")
|
|
return labnameList[luckyNum]+"实验室"
|
|
|
|
# 根据学院获取所属领域,根据领域获取实验室名称
|
|
def generatorLabNameByCollegeName(collegeName):
|
|
dataPath= '.\\Data\\学院.xlsx'
|
|
collegeList=FileManager.readExcelByCol(dataPath, 0)
|
|
areaList=FileManager.readExcelByCol(dataPath,1)
|
|
collegeIndex=collegeList.index(collegeName)
|
|
subjectArea=areaList[collegeIndex]
|
|
print(subjectArea)
|
|
return generatorLabNameBySubjectArea(subjectArea)
|
|
|
|
# generatorPersonName()
|
|
# generatorLabName("信息领域")
|
|
# generatorLabNameByCollegeName("工程学院") |