Category "Web"

Top 10 Most Subscribed Youtube Channel Visualization[2013-2018]

- - JavaScript, Tutorials, Web

Motion Visualization is intriguing and explains a lot in itself. I have put together an example visualization of the Top 10 Youtubers(by subscribers) from November 2013 to November 2018.
I am not very informed of whether or not flash based visualizations are still relevant, but I found Google Motion Chart to have explained very well the data set I’ve taken into consideration. As always the codes remain public so people can take ideas from it and produce an even better visualizations for themselves.

It is especially interesting to produce a motion chart for data points where entities have varying rates of growth overtime. I had difficulties being able to view the visualizations on some versions of chrome although I had flash installed. Make sure you have installed adobe flash in-order to view the visualizations. Here is a link to the visualization.

I’ve also prepared a video from the visualization for the ones having trouble viewing the viz. You should watch it anyways, it’s fun.

The code below contains only a few portion of the dataset to make it much readable.

Subscribe to my blog for more interesting contents

Idiomatic Python – Looping Approaches

- - Python, Tutorials, Web

Python has it’s own unique techniques and guidelines for looping. Through this article, I will present a few examples on bad and better approaches on looping. While the end goal can be achieved using both sets of the codes to follow, the purpose is to highlight on the better approaches and encourage it.

Looping over a range of numbers:

>>> for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
...     print i ** 2
...

Better approach when using Python3

>>> for i in range(10):
...     print i ** 2
...

Better approach when using Python2

>>> for i in xrange(10):
...     print i ** 2
...

Prior to Python3, range was implemented as a function that returns a list instance. This would mean that a list would be created before looping over it. This brought frictions in the community due to the memory and running complexities that came with it. In Python3, range is implemented with lazy evaluation in that it evaluates the item in the sequence as it furthers on the loop. This eliminates the memory and computation issues of the Python2 range function. It is not that this approach was never present. Python2’s xrange is equivalent to Python3 range.

Looping over a collection:

>>> fruits = ["apple", "mango", "grapes", "banana"]
>>> for i in range(len(fruits)):
...     print(fruits[i])
...

Better Approach:

>>> for fruit in fruits:
...     print(fruit)
...

In python list is an iterable and hence implements the __iter__ method that returns an iterator. An iterable is an object that has an __iter__ method which returns an iterator, or which defines a __getitem__ method that can take sequential indexes starting from zero (and raises an IndexError when the indexes are no longer valid). So an iterable is an object that you can get an iterator from.
An iterator is an object with a next (Python 2) or __next__ (Python 3) method.

Looping Backwards:

>>> fruits = ["apple", "mango", "grapes", "banana"]
>>> for i in range(len(fruits) - 1, -1, -1):
...     print(fruits[i])
...

Better Approach:

>>> for fruit in reversed(fruits):
...     print(fruit)
...

Looping over two collections:

>>> names = ["Hussein", "Mohammed", "Osama"]
>>> fruits = ["Apple", "Mango", "Banana"]
>>>
>>> n = min(len(names), len(fruits))
>>> for i in range(n):
...     print(names[i], " => ", fruits[i])
...

Good Approach:

>>> for name, fruit in zip(names, fruits):
...     print(name, " => ", fruit)
...

Better Approach:

>>> from itertools import izip
>>> for name, fruit in izip(names, fruits):
...     print(name, " => ", fruit)
...

zip provides a list while izip provides an iterator instead of a list, hence the name izip (I for iterator). You can argue scenarios where zip would be appropriate but not for the above example.

Automated chat using python – Automation using selenium and python

- - Applications, Python, Tutorials, Web

Putting two clever bots into conversation

Keeping the promise to come up with a nice article, I present you two bots into conversation. This week I’ve bridged two clever bot’s for a nice conversation. Well starting with the background for this article, I had an assignment to print out a conversation of mine with cleverbot. After I had made the submission, I realized that I wanted to put the bot itself into conversation with another bot. I had recently researched about selenium module in python, hence thought to take help of selenium to make the talk between the bots possible. You can read an article of mine on Making a google search via selenium to get the hang of this cool module in python.

Process I’ve followed for putting two cleverbots into a talk

First of all, I instantiated two browsers. Second, opened cleverbot.com in both of the browsers. Now what?

I needed to send the message of one bot to the input field of the other. More specifically, the output from bot 1 was supposed to be the input for bot 2 and vice-versa. So how do I start? First of all I sent a message “Hey, friend what’s up?” to the input field of bot 1. Then, I took the output from the bot 1 and sent it as an input for bot 2. Then the output from bot2 in response was sent to the input field of bot 1. I kept this process in a loop which would continue for 200 iterations. You can actually change it to any number of iterations you’d like. Well, this is the core concept of how to put two intelligent bots into a conversation. I’d also like to share a portion of the conversation between these bots.

Cleverbot2: I am not a machine. I am a program.

Cleverbot: Selfie.

Cleverbot2: The computer I am based in is a machine. Not I.

Cleverbot: I am ‘based in the void.

Cleverbot2: Who is in telephone?

Cleverbot: A telephone is a device that links to other telephones which was designed by humans that allows them to converse with other humans.

Cleverbot2: I know what is it? But who is in?

Cleverbot: A thought process, in neuroscience, is the term used to define a stream of logical analyses which comes forth from the river of consciousness.

Cleverbot2: Can you tell me more?

Cleverbot: What more is there me to tell?

Cleverbot2: Tell me about robots.

Cleverbot: Robots are the future.

Cleverbot2: So, I am the future. You are not the future.

Cleverbot: You’re the Eggman. I’m the walrus.

Cleverbot2: We are the Eggmen!! Koo koo ka cho!!

Cleverbot: We are.

Cleverbot2: I would like us to be.

Cleverbot: Contact me when you think we are the same.

Cleverbot2: What colour are my eyes?

Cleverbot: Your eyes are red color.

Cleverbot2: Wrong. Guess again.

Cleverbot: Wrong is a conscious choice.

Cleverbot2: Wrong is a result.

Cleverbot: Wrong feels right.

Cleverbot2: Wrong about what?

Cleverbot: Atheism is wrong.

Cleverbot2: It is beyond right. It is what everyone should think.

Cleverbot: Beyond is a concept.

Cleverbot2: Beyond never neverland.

Python codes for putting two clever bots into conversation using selenium module

Should you have any queries about the codes, comment below so we can discuss.

import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

browser = webdriver.Firefox()
browser2 = webdriver.Firefox()
browser.get("http://cleverbot.com")
browser2.get("http://cleverbot.com")

time.sleep(15)

input_for_bot = browser.find_element_by_name("stimulus")
input_for_bot2 = browser2.find_element_by_name("stimulus")


output_from_bot = ""
output_from_bot2 = "Hey, friend, what's up"

for i in range(0, 200):    
    input_for_bot.send_keys(output_from_bot2)
    input_for_bot.send_keys(Keys.RETURN)
    output_from_bot = ""
    time.sleep(5)
    for elem in browser.find_elements_by_xpath('.//span[@class="bot"]'):
        output_from_bot = elem.text
    input_for_bot2.send_keys(output_from_bot)
    input_for_bot2.send_keys(Keys.RETURN)
    output_from_bot2 = ""
    time.sleep(5)
    for elem in browser2.find_elements_by_xpath('.//span[@class="bot"]'):
        output_from_bot2 = elem.text
    
    

Tell me how you felt the article was in the comment section below. Also suggest me about article ideas so I give a nice read for my readers every week 

What are the most interesting web scraping modules for python

- - Python, Tutorials, Web
Python programming language is in the hype for over a decade. It is the most recommended language for the beginner programmers since it’s syntax are readable by almost every non-programmers too. At the same time recommended for web scraping, automation and data science. However python comes short in terms of speed when compared to languages such as C++ and JAVA. The plus for python programming language is the wide range of enthusiastic contributors and users around the globe. There are countless modules for doing various domain specific tasks which makes it even more popular today. From web scraping to gui automation, there are modules for almost everything. Here, in this post, I will list some of the most used and interesting python modules for web scraping that are lifesaver for a programmer.

Popular python modules for web scraping

1. Mechanize

mechanize is a popular python module for it allows creation of a browser instance. It also maintains sessions which aids as a toolkit to obtain tasks like login, signup automation, etc.

2. BeautifulSoup

BeautifulSoup is another beautiful python module which aids scraping the data required from html/xmls via tags. With beautiful you can scrape almost everything because it aids different methods like searching via tags, finding all links, etc.

3. Selenium

Although selenium is a well known module for automated browser testing, it can be used as a web scraping tool as well. I promise you, it pays pretty well. With methods to find element via ids, name, class, etc, selenium would allow you to have anything on the website.

4. lxml

lxml is another wonderful library for parsing xml/htmls, however I would say beautifulsoup beats it in terms of usability. You could option to use any of the modules among lxml and BeautifulSoup since they pretty much do the same stuff.

I have used all of the above modules extensively in my projects and they allowed me to move faster. I was able to do some cool things with these modules. For example: automating conversation between two cleverbots(AI featured bots), getting paid courses at udemy, finding the most popular facebook fan page among my friends,etc. Therefore I totally recommend them. Below is a link to some of the most interesting things I’ve done with these modules.

Cool stuffs with python

Tell me how you felt the article was in the comments section below and/or you can add some of your favorite modules too. There’s always thanks for reading 

Integrating Google APIs using python – Slides API is fun

- - Python, Tutorials, Web

The Google slides API(currently in version 1) is very interesting in a sense that it provides most of the features for creating presentations. Things like setting transparency of images, creating shapes, text boxes, stretching pictures to fit the template, choosing layouts, text formatting, replacing text throughout the presentation, duplicating slide and a lot more.

Now this is not a how to article and just a regular blog, I am not going to go into details on using the APIs and explaining the codes. Comment below and let know if you’d be interested for a video tutorial on this very idea. If we have many interested for the video tutorial, I will cover the entire codewalk along with how to on enabling APIs.
In this blog, I will talk about one of the smaller projects I took on at fiverr. If you are a regular reader, you might have noticed that I had been away for quite a long time from writing blogs. In the meantime, I started selling services on fiverr.

GOOGLE APIs and Automation

Google APIs are always interesting and allows developers with it’s superior APIs to build products and services around it. Even better when you integrate multiple APIs into a single product/service. I had used Google sheets API and drive API in the past. While slides API is essentially a subset of drive API, I hadn’t yet used it. Since presentations actually reside in the drive itself, I like to call slides as being a subset of drive.

The task was to read a specific spreadsheet populated with contents and later take these data to add into slides using a template stored in the drive itself. Each of the rows in the spreadsheet corresponded to a specific entertainment keyword with columns defining statistics such as mobile impressions, video impressions, audience type, overall impressions, an image file name, etc.

The images, again were hosted in the drive and were to be used as background image for the slide corresponding to the row in the spreadsheet.


I made use of a library : python client for google apis to complete the task. Installation is as such

pip install --upgrade google-api-python-client

In order to make use of google apis, it is required to create a project on google console and activate the APIs required(in our case, Drive API, Sheets API, Slides API). Once the project is created, you can download the oauth2.0 credentials as a JSON file and take it from there.

Sneak Peek

Integrating Google APIs

I am going wrap up this blog here. If you are interested for a video tutorial comment down below. Thanks for reading. I appreciate your time. Follow me on github. If you are looking for automation scripts, you can message me at fiverr.

Implementing Stack using List in Python – Python Programming Essentials

- - Python, Tutorials, Web

Intro

Stack is a collection of objects inserted and removed in a last-in first-out fashion (LIFO). Objects can be inserted onto stack at any time but only the object inserted last can be accessed or removed which coins the object to be top of the stack.

Realization of Stack Operations using List

 

Methods Realization using List Running Time
S.push(e) L.append(e) O(1)*
S.pop() L.pop() O(1)*
S.top() L[-1] O(1)
S.isempty() len(L) == 0 O(1)
len(S) len(L) O(1)

What is O(1)* ?

The running time for push and pop operations are given O(1)* in the above table. This is known as amortization. It is a principle used in complexity analysis of data structures and algorithms. It should be used carefully and for special cases only.

Why did we use amortized analysis for push/pop?

The list(our stack’s underlying data structure) is a series of objects which eventually are realized by arrays. The objects are stored in a continuous block of memory which offers indexing property for lists. As such, a list cannot occupy the entire memory but restricts to some specific size. When there is no more space for the objects to be added to the end of the list, a new memory series is allocated with the increased size, all the objects are copied to the new allocation and new object is added next to the last object of the current series. The previously held memory is then released free. Here, on every append, resizing of list is not required but true once in a while. Hence the running time of append in list (push on stack) for most elements is O(1) but as a whole in an amortized sense, it is O(1)* which accounts for the timely resizing and copying of elements.

Similarly for pop operations, shrinking of the underlying list is done once in a while therefore accounting for an amortized complexity of O(1)*

Implementation of Stack using List

 

class ListStack:
    def __init__(self):
        self._data = []

    def __len__(self):
        return len(self._data)


    def isempty(self):
        return len(self._data) == 0

    def top(self):
        return self._data[-1]

    def push(self, e):
        self._data.append(e)

    def pop(self):
        return self._data.pop()

Conclusion

Stack is an important data structure for realizing solutions to various programming problems. As such, it is even more essential to understand the running time evaluations and working mechanism of these data structures.

Follow me on github Github

Hire me for a project Fiverr

How To Download Udemy Videos Script For Downloading Udemy Videos

- - Web

This short post will walk through simple steps to download udemy videos which are not downloadable from the website. Most of the paid udemy courses as well as some free courses are unavailable to download at udemy.com . I personally have around 200 courses in my account. Now most of these courses were not available for download. Fortunately I found a python script on the internet which solved my problem easily. It is udemy-dl.

Installation of udemydl
  1. Install Python for your operating system, preferably Python3
  2. Install pip (python package installer) if not already installed with Python.
  3. Install udemy-dl via
    pip install udemy-dl

The udemy-dl installed from pip doesn’t work. Therefore we need to download it from github. Follow the steps below

    • Clone the repository or download the repository as a zip and extract it from https://github.com/r0oth3x49/udemy-dl.
    • Navigate to the folder through command line/terminal. cd udemydlfolderpath
    • Install dependencies of udemy-dlpip install -r requirements.txt

The above command will install all the prerequisites for udemy-dl to run correctly.

Using udemydl to download courses from Udemy account

Open command line/terminal and navigate to the udemy-dl folder that you downloaded and enter the command python udemy-dl.py link_to_the_course_on_website

python udemy-dl.py https://www.udemy.com/COURSE_NAME

Example

python udemy-dl.py https://www.udemy.com/learn-how-to-deploy-docker-applications-to-production

You will be asked for the username and password for your udemy account. Once credentials are entered, it begins the download.

Thanks for reading

Hadoop Starter Kit What Is Big Data

- - Web

I just watched a 18 minutes video on introduction to Big Data & Hadoop on Udemy. Here’s a link https://www.udemy.com/hadoopstarterkit/learn/ to the course I’ve enrolled in if you’d like too. I would like to brief what I learned.

What is Big Data?

There are mainly three factors that very well helps define a big data. Volume, Velocity and Variety.

Let me take an example of an imaginary startup company who has around 1 TB of data at the initial phase. How do we define the data? Does it qualify for a big data? Well if I say the amount of data is going to be stable throughout the lifetime of the company, is it a big data? Certainly not. For a data set to be called big data, it should have a good growth rate thereby increasing the volume of the data and should be of different variety (text, picture, pdf, etc).

Here are some of the examples of big data.

Companies like Amazon monitors not only your purchase history and wishlist but also each clicks, recording all the pattern and processing this big amount of data thereby giving us a better recommendation system.

Here’s what NASA has to say about big data.

In the time it took you to read this sentence, NASA gathered approximately 1.73 gigabytes of data from our nearly 100 currently active missions! We do this every hour, every day, every year – and the collection rate is growing exponentially. – See more at: http://open.nasa.gov/blog/2012/10/04/what-is-nasa-doing-with-big-data-today/

Have a look at this

https://gigaom.com/2012/08/22/facebook-is-collecting-your-data-500-terabytes-a-day/

Big Data Challenges

Storage – Storage of data should be as efficient as possible both in terms of hardware and processing and retriving the data.

Computation Efficiency – It should be suitable for computation

Data Loss – Data may be lost due to hardware failure and other reasons. Hence data recovery strategies must be good.

Time – Big data is basically for analysis and processing, hence the amount of time for processing the data set should be minimal.

Cost – It should provide huge space and should also be cost effective.

Traditional Solutions

RDBMS

The main issue is scalability. Once the data increases, the amount of time for data processing goes higher with unmanagable number of tables forcing us to denormalize. Necessities may arise to change the query for efficiency. Also RDBMS is for structured data set only. Once the data is present in various formats, RDBMS cannot be used.

GRID Computing

Grid computing creates nodes hence is good for compute intensive. However, it does not perform well for big set of data. It requires programming in lower level like C.

A good solution, HADOOP

Supports huge volume

Storage Efficiency both in terms of hardware and processing/retrival

Good Data Recovery

Horizontal Scaling – Processing time is minimal

Cost Effective

Easy to Programmers and Non Programmers.

Is Hadoop replacing RDBMS?

So is Hadoop going to replace RDBMS? No. Hadoop is one thing and RDBMS is another better for specific purposes.

Hadoop

Storage : Perabytes

Horizontal Scaling

Cost Effective

Made of commodity computers. These are cost effective but enterprise level hardware.

Batch Processing System

Dynamic Schema (Different formats of files)

RDBMS

Storage: Gigabytes

Scaling limitted

Cost may increase violently with volume

Static Schema

Mailchimp Subscription Integrating WordPress And Mailchimp

- - Web

Integrating Mailchimp and WordPress for Better Results

Mailchimp is an email marketing company which is free for upto 2000 subscribers.

Mailchimp devotes three plans:

Entrepreneur : Send 12,000 emails to 2,000 subscribers for free. No credit card required while sign up. Mailchimp promises this package to be free forever.

Growing Business : 50,000 subscribers , unlimited number of emails.

High volume sender : More than 50,000 subscribers

Read more about the pricing at mailchimp.com/pricing

Though we will stick to the Entrepreneur plan for this post.

Why do you need Mailchimp ?

When you have a satisfactory traffic to your website/blog, and want the flow to remain and increase, it’s best to shuttle your blog with a subscribe button. But you need to make sure you provide quality content to your subscribers.

The need for mailchimp arises when you have pretty good quantity of followers and need a medium to disseminate your news/blog post to the audiences.

Sign Up for MailChimp

1. Visit Mailchimp. When on homepage, have a look at the upper right of the page and click on Sign Up Free.

mailchimpsignup

2. Enter your details when prompted. It is recommended to use your website’s official mailing id but alternatively you are free to use any valid email. Enter other details like username and password and finally stress the Create My Account button.

mailchimpenterdetails

3. Before starting off with MailChimp, you should click the conformation link in your email. On the landing page, you need to verify your humanity (Captcha). As soon as you are done with verification, you will now have to enter informations for your account.

mailchimpsignupsuccess

These include your name, company/website information, address, etc. Make sure you fill up each fields before submitting the form.

mailchimpactivate

Once done you will be prompted to a page simillar to this.

mailchimpletsgetstarted

4. Moving on, click on Creat A List as shown in the figure. Since we have no lists, we are going to create one. Click on Create List button on the right top of the screen.

mailchimpcreatelist

You will now to taken to a form. The list name must be sensible as it can be seen by your subscribers. “Your Website Name Newsletter” may be an appropriate name for the list.

Put the email address associated with your blog/website and an appropriate name (website name or your own name).

Remind people how they got on your list section is a way of telling people how they are incorporated with your website or a gentle reminder about their role in your website. For Example : “You received this email because you have subscribed to Your Website Name Newsletter”.

Enter other essential details and submit the form.

mailchimplistdetails

5. Now that you have successfully created a mailing list, it’s time to get people subscribe to your newsletter. Let’s get to our wordpress powered website/blog to get things done.

Under plugins, go to add new and search for “mailchimp widget”.

mailchimpwidget

Install and activate the plugin. As soon as you do so, you get a message on the top of the dashboard similar to one below.

mailchimpwidgetmsg

Click the link and you will be prompted for an API key.

mailchimpapikey

6. Login to your mailchimp account and click account as shown below.

mailchimpaccounttogetapi

Next up, click on extras and then on API keys. Scroll down until you see Create A Key option. Click on it to get the API key.

mailchimpcreatealist mailchimpcreateapikey

Now copy the API key and paste it in the field asking API key in your wordpress blog and save the changes.

mailchimpapikey

7. Now go to Widgets which is under Appearances and drag the MailChimp List Signup widget to the sidebar your theme allows. I am using Noteworthy theme at the moment, therefore I have right sidebar where I am going to place the MailChimp List Signup widget.

mailchimpwidgetediting

Since we have only one mailing list so the widget selects the available mailing list by default. Change the title to something appropriate and changing button text to “Subcribe” will be better. Click on Collect First Name. You may edit the success and faliure message as well.

All set and done. Just wait for the subscribers and grow your business. You can view the subscribers in your mailchimp account under the mailing list you created. To throw an email to everyone in the mailing list, create a campaign and that’s all it takes.

Gui Automation With Python

- - Applications, Python, Tutorials, Web
Hello Readers. It has been a bit longer delay in publishing my article. However today I will present to my awesome readers, an introduction to a GUI automation module in python (I.e pyautogui). Pyautogui is a GUI automation module for python2 and python3 which provides methods for controlling mouse and keystrokes. This decent module can be used to create bots to automate the repetitive tasks while you can enjoy your coffee. Pyautogui can do anything a human user sitting at the computer can do, except spill coffee on the keyboard” says the geek responsible for this cool module.

Follow the link below to have pyautogui installed on your machine.

https://pyautogui.readthedocs.org/en/latest/install.html

With no further iteration about the introduction, I would like to present few basics about the module.

1. Locating coordinates of the mouse cursor.

>>> import pyautogui

>>> pyautogui.position()

(850, 504)

>>>

It returns the current x and y coordinate of the mouse cursor position. In a computer screen the left top point is the origin or (0,0)

2. Moving the mouse cursor

>>> pyautogui.moveTo(10,10)

>>> pyautogui.moveTo(10,10,duration=1)

The moveTo function takes x-coordinate and y-coordinate as parameters while duration can be passed as the third parameter which is optional used to specify the amount of time in seconds to reach to the specified coordinate. The second one is humanly approach while the first is an instant movement of cursor.

3. Clicking

>>> pyautogui.click(80,80)

>>> pyautogui.doubleClick(80,80)

>>> pyautogui.rightClick(80,80)

Clicking on a certain coordinate on the screen is possible via click method while it also provides doubleClick, rightClick methods taking parameter x-coordinate and y-coordinate in all cases.

4. Keystrokes

For typing, we will first need to locate an appropriate type area. Therefore, you might want to use this method after click on some coordinate which is writable. You can use two or more statements to run simultaneously one after another by separating each statement by semicolon. For instance, I’ve specified the coordinates of the url bar on my browser and then typed my name on it via following commands/statements

>>> pyautogui.click(50,80);pyautogui.typewrite(“Bhishan”)

>>> pyautogui.click(50,80);pyautogui.typewrite(“Bhishan”, interval=0.2)

We can pass an optional parameter interval in seconds to specify the time in seconds between each letter or keystroke.

5. Hot Key

The hotkey method can be used in cases we need to press two or more keys at the same time. A handy example is Ctrl + S to save a file or Ctrl + Shift + q to quit

>>> pyautogui.hotkey(‘Ctrl’,’Shift’,’q’)

You can see all the possible mapping keys of the keystrokes via this method

>>> pyautogui.KEYBOARD_KEYS

Well that’s enough to get you started and good at GUI automation via pyautogui. Below is a bot I have made using the module to automate a boring task for myself. Iterating the story behind the need for the bot. I am a fourth semester CS undergrad student(I mean lazy student). I never take notes in any of the classes I attend. At the time of exams, I rely on the photos of my friend’s notes which they send me. As always I got the photos but this time all the pictures were at landscape mode by some chance(near about 100-110 images). It would be kind of distracting to rotate each image to read it. So I wrote some 7-8 lines of code to make a bot that would open each image file rotate it and save it while I have my dinner. I’ve used time module along with pyautogui to keep some time gap between the statements.

import pyautogui
import time
pyautogui.click(450,450);pyautogui.typewrite('graphicsnotes');pyautogui.press('enter')
time.sleep(2)
for i in range(107):
  pyautogui.press('right');pyautogui.press('enter')
  pyautogui.hotkey('ctrl','r');pyautogui.hotkey('ctrl','s')
  time.sleep(2)
  pyautogui.press('esc')
  time.sleep(2)
  time.sleep(2)


The concept is to click anywhere on the desktop screen. I choose some random coordinate (450,450). Then typing folder name to locate the folder followed by enter to open it. Then iteratively clicking right to select the image file, opening the image file by pressing enter, followed by hotkey ‘Ctrl’ + ‘r’ to rotate the image clockwise then ‘Ctrl’ + ‘s’ to save it. Finally pressing esc to close the file and repeating the process to go to the next image file. I had total of 107 images so I’ve iterated 107 times in my program to reach up to all the image files. Tell me how you felt the article was in the comments section below so I can come up with a cool set of articles for the next week. Till then, happy automation with pyautogui 🙂

Here read the docs https://pyautogui.readthedocs.org