📌  相关文章
📜  python 从字符串中获取随机字符 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:44.901000             🧑  作者: Mango

代码示例4
import random

#String
string = "abcdefghijklmnopqrstuvwxyz"
array = []
for c in string:
  array += [c]
 
print(array[random.randint(0, len(array)-1)])

# Faster and more efficient
random.choice(string)