• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

Write an application to check which country’s phone number is in Python

AnonyViet by AnonyViet
January 31, 2023
in Tips
0

Today, I will show you how to create an application that looks up that phone number to see if it belongs to the Country in Python. The implementation is quite simple because we already have the libraries available. This article is quite basic because it is for beginners to understand Python. If you want to learn more about Python, please comment below, anonyviet will release more advanced articles.

Join the channel Telegram of the AnonyViet 👉 Link 👈

Write an application to check the phone number of which country in Python 3

This is a very simple phone number lookup application, so you only need a basic knowledge of Python to be able to complete this application.

How to create a phone number lookup application

Request

You need to install the above python libraries to use in this application.

Setting

pip install python-tk, phone-iso3166, pycountry

I will use phone-iso3166 to determine the abbreviation of the country and then assign it to variable alpha_2 and pycountry to determine the full name of that country using alpha_2 that we have gathered from phone-iso3166.

Sample code

>>> import pycountry
>>> from phone_iso3166.country import phone_country
>>> code = phone_country("255757295721")
>>> code
'TZ'
>>> pycountry.countries.get(alpha_2 = code)
Country(alpha_2='TZ', alpha_3='TZA', common_name="Tanzania", name="Tanzania, United Republic of", numeric="834", official_name="United Republic of Tanzania")
>>> 

Now we know how to get country information from phone number, but this app still works as command line. So now, we will design the GUI for the application.

Create file app.py

Open notepad and create app.py file with the content below

import json 
import pycountry
from tkinter import Tk, Label, Button, Entry
from phone_iso3166.country import phone_country


class Location_Tracker:
    def __init__(self, App):
        self.window = App
        self.window.title("Phone number Tracker")
        self.window.geometry("500x400")
        self.window.configure(bg="#3f5efb")
        self.window.resizable(False, False)

        #___________Application menu_____________
        Label(App, text="Enter a phone number",fg="white", font=("Times", 20), bg="#3f5efb").place(x=150,y= 30)
        self.phone_number = Entry(App, width=16, font=("Arial", 15), relief="flat")
        self.track_button = Button(App, text="Track Country", bg="#22c1c3", relief="sunken")
        self.country_label = Label(App,fg="white", font=("Times", 20), bg="#3f5efb")

        #___________Place widgets on the window______
        self.phone_number.place(x=170, y=120)
        self.track_button.place(x=200, y=200)
        self.country_label.place(x=100, y=280)

        #__________Linking button with countries ________
        self.track_button.bind("<Button-1>", self.Track_location)
        #255757294146
    
    def Track_location(self,event):
        phone_number = self.phone_number.get()
        country = "Country is Unknown"
        if phone_number:
            tracked = pycountry.countries.get(alpha_2=phone_country(phone_number))
            print(tracked)
            if tracked:
                country = tracked.official_name
        self.country_label.configure(text=country)



PhoneTracker = Tk()
MyApp = Location_Tracker(PhoneTracker)
PhoneTracker.mainloop()

To run the newly created file on windows, open cmd and type the command python app.py to launch the program

Result

When you enter the phone number, note the first 0 instead of 84 okay, for example: 84304xxxxxx. After entering, you can click Enter to know which country the phone number is from.

Write an application to check which country’s phone number is in Python

Done, you’ve just created your own country-specific phone number location app. If you find this app interesting, please share it with your friends. You can also see more ways hide messages in pictures that Anonyviet introduced.

The article achieved: 5/5 – (100 votes)

Tags: applicationcheckcountrysnumberphonePythonwrite
Previous Post

Download FreeGate 7.71 Full – Tool to bypass Firewall to access blocked Web

Next Post

Share Tool DDOS 2016 (build *.exe)

AnonyViet

AnonyViet

Related Posts

How to add sliders to Facebook Stories to easily rewind videos
Tips

How to add sliders to Facebook Stories to easily rewind videos

April 21, 2026
How to change the default font on Windows 10
Tips

How to change the default font on Windows 10

April 13, 2026
5 tips for using a Browser to replace an App (helps save RAM, time and money)
Tips

5 tips for using a Browser to replace an App (helps save RAM, time and money)

April 13, 2026
How to make funny MeMe photos without Photoshop within 10 seconds
Tips

How to make funny MeMe photos without Photoshop within 10 seconds

April 11, 2026
How to quickly design your own Logo without Photoshop
Tips

How to quickly design your own Logo without Photoshop

April 10, 2026
How to convert Website into App on Windows
Tips

How to convert Website into App on Windows

April 9, 2026
Next Post
Share Tool DDOS 2016 (build *.exe)

Share Tool DDOS 2016 (build *.exe)

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

April 27, 2026
Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 2026
How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

April 27, 2026
Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

April 27, 2026
Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply