secrets.choice(seq): 从序列中随机选择一个元素,比random.choice()更安全
import secrets fruits = ["apple", "banana", "orange"] fruit = secrets.choice(fruits) print(fruit)
secrets.choice(seq): 从序列中随机选择一个元素,比random.choice()更安全
import secrets fruits = ["apple", "banana", "orange"] fruit = secrets.choice(fruits) print(fruit)