Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は通常、次のことを行います。
nextPreset = element.firstChild while nextPreset != None: #doThings nextPreset = nextPreset.nextSibling
次のようなものがあるかどうか疑問に思っていました:
for child in element.children: #doThings
メソッドを見ました_get_childNodesが、プライベートです...
_get_childNodes
1 つのプロジェクトでそれを数回行う場合は、次を使用できます。
def iterate_children(parent): child = parent.firstChild while child != None: yield child child = child.nextSibling
そして、する
for child in iterate_children(element): # foo