planRun / some_base_method /random_id.py
sanbo
update sth. at 2025-01-04 18:31:02
68515e1
raw
history blame
629 Bytes
import random
import string
# η”Ÿζˆ4δΈͺιšζœΊε°ε†™ε­—ζ―
letters = ''.join(random.choices(string.ascii_lowercase, k=4))
# η”Ÿζˆ6δΈͺιšζœΊζ•°ε­—
numbers = ''.join(random.choices(string.digits, k=6))
# η»„εˆζˆζœ€η»ˆηš„ε­—η¬¦δΈ²
random_id = f"chatcmpl-{letters}{numbers}"
print(random_id)
# ιšζœΊη”Ÿζˆ ID
def general_id(zimu=4, num=6):
import random
import string
letters = ''.join(random.choices(string.ascii_lowercase, k=zimu))
numbers = ''.join(random.choices(string.digits, k=num))
return f"chatcmpl-{letters}{numbers}"
if __name__ == '__main__':
for i in range(100):
print(general_id())