[英]In Python with selenium, what does the Unused variable 'x'pylint(unused-variable) mean?
I am making a bot for a web app videogame but I get this error ('Unused variable 'x'pylint(unused-variable)) and I don't really understand it as to why I am getting it.我正在为 web 应用程序视频游戏制作机器人,但我收到此错误('未使用的变量 'x'pylint(unused-variable)),我不太明白为什么会得到它。
def redeem_pack_coins():
for x in range(0, 5):
try:
bronzePackRedeem = driver.find_element_by_xpath(
'/html/body/main/section/section/div[2]/div/div/section[2]/div/div/div[2]/div[2]/button[2]')
bronzePackRedeem.click()
break
except:
time.sleep(0.1)
You are not using the variable x
.您没有使用变量
x
。 In your long, your are essentially assigning each value in range(0,5) to x, but you never use x
.在您的 long 中,您实际上是将 range(0,5) 中的每个值分配给 x,但您从不使用
x
。
You could try something like this if you just want to run it 5 times:如果您只想运行 5 次,可以尝试这样的操作:
import itertools
for _ in itertools.repeat(None, 5):
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.