Cara menggunakan python advanced project

You not only learn more Python by implementing what you already know but, in the end, you can see how all your hard work pays off.

Recently, I’ve been automating tasks more than often due to my lack of time. Thanks to that I have 5 new projects that I classified as beginner, intermediate, and advanced.

You’ll find links to the full scripts and tutorials to solve each project. Also, I’m leaving a challenge to each of them to test your Python skills.

1. Automate Microsoft Word [Beginner Project]

How many times did you have to use Word to create a cover letter, contract agreement, resume, or report?

If you can’t count them, this project is for you.

In this project, we’ll automate the generation of Word documents using Python and a library called docxtpl. To do so, we need a template of the document we want to automate. Inside the template, we have to introduce placeholders on each word we want to replace later. We use the {{}} symbol for the placeholders.

To make things easier, I already created a template for a cover letter. Here’s how the template we’ll use looks.

Image by author

To make this project beginner friendly, we only have to replace the elements {{my_name}}, {{my_phone}}, {{my_email}}, {{my_address}}, and {{today_date}} using Python anddocxtpl.

In the video below, you can download this template, get the script, and follow the steps to solve this project.

Challenge: If you want to take this project to the next level, try extracting data from an Excel file and introducing it in the Word template.

The second part of the tutorial above has an Excel file that looks like the following table.

+-------+-----+------------+----------------+
| Name | ... | address | job |
+-------+-----+------------+----------------+
| Frank | ... | 123 Avenue | Data Scientist |
| ... | ... | ... | ... |
| John | ... | XYZ Avenue | Web Developer |
+-------+-----+------------+----------------+

You should generate a new document, for each row of the table.

2. Automate Sending Emails [Beginner Project]

One of the most boring tasks I used to do at work was sending emails.

Important emails should be read and answered carefully, but emails that are part of an everyday routine should be automated! This is what this beginner project is all about. We’ll automate sending emails with Python.

How to automate this task? We only need to use the built-in modulessmtplib and email . We need smtplib to send emails using the Simple Mail Transfer Protocol [SMTP], and the email package to read, write, and send more complex MIME messages.

Below there’s a step-by-step tutorial to automate sending emails with Gmail. Here’s what it covers:

  • How to turn on 2-step verification to be able to use Gmail with Python
  • How to send a plain email with Python
  • How to deal with an SSL error you may encounter

Challenge: If you want to make this project more challenging, try to attach images to your emails. To do so, you need to use the imghdr library.

3. Automate Filling Web Form [Intermediate Project]

One of the most tedious tasks on the internet is filling in web forms.

I mean that! Filling in your name, phone number, address, and more information over and over again is boring. Things get worse when you have to come up with fake data to fill in a survey.

In this intermediate project, we’re going to fill in fake data to web forms using Python. How to automate this task? We’ll use a web automation library that allows us to perform web actions like going to websites, typing text, and clicking on buttons.

Below there’s a step-by-step tutorial on how to automate this tedious task with Python. Here’s what it covers:

  • How to fill in data in a single form
  • How to generate fake data with the faker library
  • How to fill in multiple web forms

Challenge: The form we fill in this tutorial has simple elements. If you want to make this project more challenging, add advanced elements to the form such as dropdowns and multiple-choice questions. Then try to automate this advanced form.

4. Automate Tinder [Advanced Project]

Swiping right on dating apps is so time-consuming that once you get matches, you become lazy in the most important part of online dating — converting matches into actual dates!

This advanced project consists in creating a bot that swipes right for you, so you can later work on your pickup lines and increase your conversion rate.

What makes this project advanced? Many things. To name a few:

  • Login: No matter what login option you use [Google, Facebook], Tinder will send a code to your phone number. You need to use this code to log in to Tinder. To easily deal with this, we need to keep a Google Chrome session active and then control it with Selenium.
  • Tricky buttons: If you use the .click method to click on the like button, you might get errors sometimes. For this particular website, we need to use an alternative.
  • Popups: While swiping right you may encounter different pop-ups. You have to get rid of them.

Below there’s a tutorial that will help you deal with all of these issues.

Challenge: Make your bot send random pickup lines to your matches.

But only do that for the sake of this project! If you want to get more replies, don’t automate sending messages. I tried it and it’s not as effective as sending high-quality messages yourself.

5. Automate Your Own Tasks at Work [Super Advanced Project]

Without a doubt, automating a tedious task you have at work is the most challenging thing you can ever do.

Why? Most likely there isn’t a step-by-step tutorial to guide you, you have to think of what library you’d need to use, and the best approach to automate it.

To find out what to automate ask yourself these questions:

  1. What tasks do I keep doing over and over again?
  2. What specific parts can I automate with Python?
  3. What Python libraries should I use to automate this project?

Even if you don’t find a tutorial on how to automate that specific task if you know the answer to question #3, you can check the documentation or read a guide to get started with that library.

Let me know in the comments what task you’re automating right now!

Automate your life with Python! Get my FREE Automation Cheat Sheet by joining my email list with 20k+ people.

If you enjoy reading stories like these and want to support me as a writer, consider signing up to become a Medium member. It’s $5 a month, giving you unlimited access to thousands of Python guides and Data science articles. If you sign up using my link, I’ll earn a small commission with no extra cost to you.

Bagaimana cara menjalankan Python?

Menjalankan Python.
Buka terminal CTRL + ALT + T..
Ketik python maka Anda akan masuk ke Python shell..
Tuliskan script Python Anda, contoh: print["Selamat datang di Python"] . jika sudah tekan tombol ENTER , dan script Python akan dijalankan/eksekusi..
Untuk keluar dari Python shell ketik exit[].

Berapa lama waktu untuk menguasai Python?

Secara umum, dibutuhkan sekitar dua hingga enam bulan untuk mempelajari dasar-dasar python. Namun, Anda bisa belajar untuk menulis program pendek pertama dalam hitungan menit. Sementara itu, menguasai python secara lengkap bisa memakan waktu berbulan-bulan hingga bertahun-tahun.

Python bisa bikin apa?

Python adalah bahasa pemrograman yang banyak digunakan dalam aplikasi web, pengembangan perangkat lunak, ilmu data, dan machine learning [ML]. Developer menggunakan Python karena efisien dan mudah dipelajari serta dapat dijalankan di berbagai platform.

Mengapa Python cocok untuk pemula?

Anda ingin belajar Python, tapi bingung mulai dari mana? Bahasa pemrograman Python adalah bahasa yang memang disarankan untuk pemula karena perintahnya yang ringkas, sehingga mudah dipahami.

Bài mới nhất

Chủ Đề