在 2016年9月20日星期二 UTC-4上午8:17:13,BartC写道: > On 20/09/2016 13:12, 38016226...@gmail.com wrote: > >>>> d = {} > >>>> keys = range(256) > >>>> vals = map(chr, keys) > >>>> map(operator.setitem, [d]*len(keys), keys, vals) > > > > It is from python library. What does [d]*len(keys) mean? > > d is the name of dict but put d in [] really confused me. > > > > if len(keys) is 5 then [d]*5 is: > > [d,d,d,d,d] > > [d] is a list, containing one item, a dict if that is what it is. > > -- > Bartc
Thank you. I understand now -- https://mail.python.org/mailman/listinfo/python-list