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.
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
. In your long, your are essentially assigning each value in range(0,5) to x, but you never use x
.
You could try something like this if you just want to run it 5 times:
import itertools
for _ in itertools.repeat(None, 5):
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.