Skip to content

Commit c99df75

Browse files
committed
Update active_code.py
1 parent d912880 commit c99df75

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

lwh/2/active_code.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,9 @@
1414

1515
def generate_active_code():
1616
active_code = []
17-
ascii_ = list(string.ascii_letters)
18-
for i in range(200):
19-
active_code_temp = ""
20-
for j in range(19):
21-
num_or_char = random.randint(0, 1)
22-
# 用"-"连接
23-
if j == 4 or j == 9 or j == 14:
24-
active_code_temp = active_code_temp + "-"
25-
# 生成数字
26-
elif num_or_char == 0:
27-
active_code_temp = active_code_temp + str(random.randint(0, 9))
28-
# 生成字符
29-
elif num_or_char == 1:
30-
active_code_temp = active_code_temp + \
31-
str(ascii_[random.randint(0, len(ascii_) - 1)])
32-
active_code.append(active_code_temp)
17+
ascii_ = string.ascii_letters + string.digits
18+
active_code = ["".join([random.choice(ascii_) for i in range(16)])
19+
for i in range(200)]
3320

3421
return active_code
3522

0 commit comments

Comments
 (0)