我有一本这样的字典:
user_dict = {
user1: [(video1, 10),(video2,20),(video3,1)]
user2: [(video1, 4),(video2,8),(video6,45)]
...
user100: [(video1, 46),(video2,34),(video6,4)]
}
(video1,10) means (videoid, number of request)
现在我想随机选择 10 个用户并进行一些计算,例如
1. calculate number of videoid for each user.
2. sum up the number of requests for these 10 random users, etc
那么我需要将随机数分别增加到20、30、40
但是“random.choice”一次只能选择一个值,对吧?如何选择多个键和每个键后面的列表?