weixin_44534192 2019-07-05 19:29 采纳率: 100%
浏览 740
已采纳

python中绘制世界地图TypeError: argument of type 'Key' is not iterable。

按网上说的,都安装了。运行时一直报错:TypeError: argument of type 'Key' is not iterable。
在网上下载的也是TypeError: argument of type 'Key' is not iterable。
请大神分析下,谢谢!

代码一:

import pygal_maps_world.maps

wm = pygal_maps_world.maps.World()
wm.title = 'North, Central, and South America'

wm.add('North Amerca',['ca', 'mx', 'us'])
wm.add('Central America',['bz', 'cr', 'gt', 'hn', 'ni', 'pa', 'sv'])
wm.add('South America',['ar', 'bo', 'br', 'cl', 'co', 'ec', 'gf', 'gy', 'pe',
                        'py', 'sr', 'uy', 've'])

wm.render_to_file('americas.svg')

代码二

import pygal


wm = pygal.maps.world.World()
wm.title = 'Populations of Countries in North America'
wm_key = {'ca':34126000, 'mx':113423000, 'us':309349000}
wm.add('North America',wm_key)


wm.render_to_file('na_populations.svg')
  • 写回答

2条回答 默认 最新

  • weixin_44534192 2019-07-06 00:52
    关注

    已解决,运行环境问题,重新安装了一遍pygal,解决了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug