Thursday, August 28, 2025
HomeLanguagesGet latest Government job information using Python

Get latest Government job information using Python

Prerequisite: Python GUI – tkinter 

In these articles, we are going to write python scripts to get the latest Government job information.

Modules Needed

  • BeautifulSoup: Beautiful Soup(bs4) is a Python library for pulling data out of HTML and XML files. This module does not come built-in with Python. To install this type the below command in the terminal.
pip install bs4

  • requests: Requests allows you to send HTTP/1.1 requests extremely easily. This module also does not comes built-in with Python. To install this type the below command in the terminal.
pip install requests

Approach:

  • Extract data form given URL
  • Scrape the data with the help of requests and Beautiful Soup
  • Convert that data into HTML code.
  • Find the required details and filter them.

Let’s see the stepwise execution of the script

Step 1: Import all dependence  

Python3




import requests
from bs4 import BeautifulSoup


Step 2: Create a URL get function 

Python3




def getdata(url):
    r = requests.get(url)
    return r.text


Step 3: Now pass the URL into the getdata function and Convert that data into HTML code

Python3




# import module
import requests
import pandas as pd
from bs4 import BeautifulSoup
 
 
res = ''
 
# link for extract html data
def getdata(url):
    r = requests.get(url)
    return r.text
 
htmldata = getdata("https://skresult.net/govt-jobs/")
soup = BeautifulSoup(htmldata, 'html.parser')
 
for li in soup.find_all("div", id="post"):
    res += (li.get_text())
 
print(res)


Output:

Application for the Latest job information with Tkinter: This Script implements the above Implementation into a GUI.

Python3




# import module
import requests
import pandas as pd
from bs4 import BeautifulSoup
from tkinter import *
from tkinter import messagebox
 
res = []
 
 
def getdata(url):
    r = requests.get(url)
    return r.text
 
 
def getinfo():
    result = ''
    htmldata = getdata("https://www.sarkariresult.com/latestjob.php")
    soup = BeautifulSoup(htmldata, 'html.parser')
     
    for li in soup.find_all("div", id="post"):
        result += (li.get_text())
    res.set(result)
 
 
# object of tkinter
# and background set for light grey
master = Tk()
master.configure(bg='light grey')
 
# Variable Classes in tkinter
res = StringVar()
 
# Creating label for each information
# name using widget Label
Label(master, text="List of the Jobs :",
      bg="light grey", font="100").grid(row=0, sticky=W)
 
# Creating label for class variable
# name using widget Entry
Label(master, text="", textvariable=res, bg="light grey").grid(
    row=3, column=1, sticky=W)
 
# creating a button using the widget
# Button that will call the submit function
b = Button(master, text="Get latest job", command=getinfo)
b.grid(row=0, column=2, columnspan=2, rowspan=2, padx=5, pady=5)
 
mainloop()


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32244 POSTS0 COMMENTS
Milvus
80 POSTS0 COMMENTS
Nango Kala
6615 POSTS0 COMMENTS
Nicole Veronica
11787 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11831 POSTS0 COMMENTS
Shaida Kate Naidoo
6727 POSTS0 COMMENTS
Ted Musemwa
7008 POSTS0 COMMENTS
Thapelo Manthata
6684 POSTS0 COMMENTS
Umr Jansen
6697 POSTS0 COMMENTS