如何遍历嵌套的子节点

时间:2019-06-27 09:55:59

标签: python firebase-realtime-database

嗨,我需要为Firebase嵌套子元素编写for循环的帮助。我提供了以下代码。非常感谢您的帮助。

      Item features
           -sdsmkdffd
              model:1234
              left 
                -sjjkjsd9999999
                     left:3456

              right
                 -sjkjksdjkjkj
                      right:0990

代码列表,

# I dont have a problem with this part of the looping
usernames = database.child("Items").child('details').get()
for user in usernames.each():
    userid = user.key()
    dtls = database.child("Items").child('details').child(userid).child('iname').get().val()       
        if dtls == name:
        dtls1 = database.child("Items").child('details').child(userid).child('idesc').get().val()
        dtls2 = database.child("Items").child('details').child(userid).child('imodel').get().val()
       usernames = database.child("Item_features").get()
       for user in usernames.each():
       userid = user.key()
       dtls55 =  database.child("Item_features").child(userid).child('model').get().val()
       if dtls55 == dtls2:
          #here I want to loop through the nested child nodes of 
          #'left'

0 个答案:

没有答案