-
Notifications
You must be signed in to change notification settings - Fork 0
/
func.py
67 lines (54 loc) · 1.29 KB
/
func.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/user/zhao/miniconda3/envs/torch-0
# -*- coding: utf_8 -*-
# @Time : 2024/3/23 15:00
# @Author: ZhaoKe
# @File : func.py
# @Software: PyCharm
import random
end_number = 15000
def get_new_id():
global end_number
end_number += 1
return end_number
def get_familyid(y: str, m: int, f: int):
res = y
if m < 10:
res += "0" + str(m)
else:
res += str(m)
if f < 10:
res += "0" + str(f)
else:
res += str(f)
return res
def get_rand_gender():
if random.random() < 0.3:
return 1
else:
return 0
class NullNameException(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
# from PIL import Image
#
# def png2ico():
# img = Image.open(r"./softwarelogo.png")
# # icon_sizes = [(16, 16), (32, 32), (48, 48), (64, 64)]
# icon_sizes = [(64, 64)]
# img.save('logo.ico', sizes=icon_sizes)
# def tolist():
# import os
# root = "C:/Program Files (zk)/PythonOperatOptimiz/SelectBreeding/"
# for item in os.listdir(root):
# if os.path.isdir(item):
# for ite in os.listdir(item):
# print(root+item+'/'+ite)
# else:
# print(root+item)
#
#
# if __name__ == '__main__':
# # png2ico()
# tolist()