使用
zip具有不错的功能的“两种”方式均可使用。
import randoma = ['Spears', "Adele", "NDubz", "Nicole", "Cristina"]b = [1,2,3,4,5]z = zip(a, b)# => [('Spears', 1), ('Adele', 2), ('NDubz', 3), ('Nicole', 4), ('Cristina', 5)]random.shuffle(z)a, b = zip(*z)
使用
zip具有不错的功能的“两种”方式均可使用。
import randoma = ['Spears', "Adele", "NDubz", "Nicole", "Cristina"]b = [1,2,3,4,5]z = zip(a, b)# => [('Spears', 1), ('Adele', 2), ('NDubz', 3), ('Nicole', 4), ('Cristina', 5)]random.shuffle(z)a, b = zip(*z)