选择一个随机函数
答
>>> def foo(): print('foo')
>>> def bar(): print('bar')
>>> from random import choice
>>> choice([foo, bar])
<function foo at 0x10499d668>
>>> choice([foo, bar])()
foo
>>> choice([foo, bar])()
bar
>>> choice([foo, bar])()
foo
+0
谢谢。这正是我所期待的。 – M213081
什么是高清? –
可以从该文件/类中调用的内容 例如'DEF介绍(): 打印( “你好”) 介绍()'适当压痕,什么 显然不是 – M213081
[random.choice(SEQ)(https://docs.python.org/3/library/ random.html#random.choice) – Lafexlos