Thank you for your reply. I am sorry that I forgot to give the complete code.
“i” is the index of “data”,and there is no other same variable outside the def.

2021-10-21 17-41-51 的螢幕擷圖1920×1080 276 KB