Day 6–7 Python

harichselvamc
1 min readJan 6, 2023

--

Day 6&7/20

On days 6 and 7 of your Python learning journey, you should choose a small project to work on using the skills you have learned so far. This could be a command-line tool, a web scraper, a simple game, or anything else you can think of. The goal is to apply the concepts you have learned and get more practice with the language.

Here are a few examples of concepts you might encounter while working on your project, along with some code snippets that demonstrate how they work:

Handling command-line arguments:

import sys

print(sys.argv) # ['script.py', 'arg1', 'arg2', ...]

Making HTTP Requests:

import requests

# making a GET request
response = requests.get("https://www.example.com")
print(response.status_code) # 200
print(response.text) # HTML content of the page

# making a POST request
data = {"key": "value"}
response = requests.post("https://www.example.com", data=data)
print(response.status_code) # 200
print(response.text) # HTML content of the page

Parsing HTML:

import bs4

html = """
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>This is an example page.</p>
</body>
</html>
"""

soup = bs4.BeautifulSoup(html, "html.parser")
title = soup.find("title").text
print(title) # "Example"

I hope that these Python Preparation Plans will help you enhance your interest in programming as well as python and then all python topics. Please feel free to provide insightful remarks in the space below.

20days-python-plans

--

--

harichselvamc

I am a quick learner with a good eye for detail. I am also an exceptional coder with a great work ethic.