Django template can't loop defaultdict

后端 未结 3 921
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 06:42
import collections

data = [
  {\'firstname\': \'John\', \'lastname\': \'Smith\'}, 
  {\'firstname\': \'Samantha\', \'lastname\': \'Smith\'}, 
  {\'firstname\': \'sh         


        
3条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 06:51

    try:

    dict(new_data)
    

    and in Python 2 it is better to use iteritems instead of items :)

提交回复
热议问题