How can I, in python, iterate over multiple 2d lists at once, cleanly?

后端 未结 10 1053
予麋鹿
予麋鹿 2021-02-05 05:15

If I\'m making a simple grid based game, for example, I might have a few 2d lists. One might be for terrain, another might be for objects, etc. Unfortunately, when I need to ite

10条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 06:21

    for d1 in alist
       for d2 in d1
          if d2 = "whatever"
              do_my_thing()
    

提交回复
热议问题