假设我有这段代码:
import xml.etree.ElementTree as ET
from time import sleep
def get_src():
while True:
path = "input.xml"
root = ET.parse(path).getroot()
nodes = root.findall('body/video')
for node in nodes:
src = node.get('src')
yield src
for i in get_src():
print(i)
sleep(3)
当xml文件的内容发生变化且循环已经在运行时,如何让python刷新nodes
?