リストの変数choice()
に変数を渡す方法はありますか?私はリストの束を持っていますし、ランダムに1つのリストから選択し、その文字列名を持つリストから選択するために返される文字列を使用したいと思います。Pythonのランダムリストの選択
A = ['1','2','3']
print choice (A) - this gets me a random choice from the list
が、私は別のリストに助けを
A = ['1','2','3']
1 = ['A','B','C']
Var1 = choice (A)
print choice (Var1) *** this is my problem, how do I pass a variable to the choice function
感謝を呼び出すための変数として選択を保存し、それを使用するようにしたいです!
'1 = ['A'、 'B'、 'C']' ?!聖なる****! – 0605002
... 'd'で始まり、 't'で終わります。それは4文字長いです。 [dict](http://docs.python.org/tutorial/datastructures.html#dictionaries)を使用します。 –