说我们有这样的:Python的字典乘法
dict = {1:[2, 3]}
m = 4
new = {1:[]} # to save time, the keys in "new" were obtained from "dict"
我想用“字典”,使“新的”,所以每个值出现在“字典”列表中多次为“M”,使:
new = {1:[2, 2, 2, 2, 3, 3, 3, 3]} # values appear "m" times
如何通过使用for循环来实现此目的?它让我感到困惑,因为我使用了很多循环,任何帮助将不胜感激。 我宁愿如果你们给出的想法,而不是给我的代码。