Issue
I've been trying to print a variable (in a loop, to count down each round) ...
Has anyone Idea to help me, because it shows me every time "IndentationError: expected an indented block" and says the error is at the print line...
And another question: Has someone an idea, how to for simplify a YouTube-viewbot?
Here's the Code:
from selenium import webdriver
import time
Timer = 15
link = "https://www.youtube.com/watch?v=9S8s1QTLhHs&t=99s"
views = 3
count = 1
a = views
driver1 = webdriver.Chrome('C:\\Users\samue\Downloads\chromedriver.exe')
driver2 = webdriver.Chrome('C:\\Users\samue\Downloads\chromedriver.exe')
driver3 = webdriver.Chrome('C:\\Users\samue\Downloads\chromedriver.exe')
driver4 = webdriver.Chrome('C:\\Users\samue\Downloads\chromedriver.exe')
driver5 = webdriver.Chrome('C:\\Users\samue\Downloads\chromedriver.exe')
driver1.get(link)
driver2.get(link)
driver3.get(link)
driver4.get(link)
driver5.get(link)
for i in range(views):
time.sleep(Timer)
driver1.refresh()
driver2.refresh()
driver3.refresh()
driver4.refresh()
driver5.refresh()
while a >= 0:
print(a, "views left")
a += -1
driver1.quit()
driver2.quit()
driver3.quit()
driver4.quit()
driver5.quit()
Solution
As indicated in the error message, an indentation block is missing. The while loop should look like:
while a >= 0:
print(a, "views left")
a -= 1
Answered By - Marc Dillar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.