Master Python through building real-world applications (Part 3)

website in line checks the first line of hosts file, now which website it is looking for?.It comes from the for loop followed by that, website in our website list..In a nutshell, the meaning of the entire line is, if our website from website list is not there in the line of host file, append/print that line..If the line has our website, then ignore that line..I hope this clears up the meaning, because it is important..And there it is, removing the websites from the list.The Fun HoursAlmost thereYou did a great work creating the website blocker but you don’t want to execute the code every day to block websites, right?.That’s why we will use a task scheduler to perform this job..We are going to use Cron Job Scheduler (it is pre-installed in the operating system, you don’t have to install anything)..Just Open cron table with sudo permission and parameter -e.add the path of our main file followed by a command — @rebootDone.It is done now..You have successfully blocked websites on our list..Reboot your computer to see the changes and if you have any problems regarding anything in the article, hit me up..My email and twitter DMs are always open.. More details

Leave a Reply