0

I have recently started using python 3 and while working on list comprehension I am seeing something completely different from python 2. I want to know why is it that while printingthe value of 'y' python3 is returning [dict_values([1]), dict_values([2])] instead of [1,2] and how I can get response in desired form i.e,[1,2]

>>> x=[{'x':1},{'y':2}]
>>> y=[i.values() for i in x]
>>> y
[dict_values([1]), dict_values([2])]
sshashank124
  • 31,495
  • 9
  • 67
  • 76
Gareema
  • 27
  • 5

0 Answers0