The original detailed article are read here How to use Encapsulation and Data Abstraction In Python
Encapsulation is one of the fundamental concepts in object-oriented programming (OOP). It describes the idea of wrapping data and the methods that work on data within one unit. This puts restrictions on accessing variables and methods directly and can prevent the accidental modification of data. To prevent accidental change, an object’s variable can only be changed by an object’s method. Those types of variables are known as private variable.
Resource :
https://pythonslearning.com/how-to-use-encapsulation-and-data-abstraction-in-python.html

The original article are also available see for source code https://pythonslearning.com/2021/04/how-to-make-your-own-mp3-music-player-in-python-using-tkinter.html

The media player is in dark theme with all the functionalities of a modern media player we can adjust the volume from the player switch back and front to previous and next songs. We can shuffle our playlist and also can move the song to any position as we want using the song slider.

Which Packages Used for create own Mp3 music player using python

from tkinter import *
import tkinter.ttk as ttk
import pygame
import os
from PIL import ImageTk,Image
import random
from tkinter import filedialog
import time
from mutagen.mp3 import MP3

For detailed see this blog post

https://pythonslearning.com/2021/04/how-to-make-your-own-mp3-music-player-in-python-using-tkinter.html

he unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework.

To achieve this, unittest supports some important concepts in an object-oriented way:

test fixture
A test fixture represents the preparation needed to perform one or more tests, and any associated cleanup actions. This may involve, for example, creating temporary or proxy databases, directories, or starting a server process.
python 3.10 release date

test case
A test case is the individual unit of testing. It checks for a specific response to a particular set of inputs. unittest provides a base class, TestCase, which may be used to create new test cases.

Positional parameters in python
When use Positional parameters in python 3.6

Use positional-only if names do not matter or have no meaning, and there are only a few arguments which will always be passed in the same order.

Use keyword-only when names have meaning and the function definition is more understandable by being explicit with names.

Positional-only arguments were proposed in PEP 570, and it’s worth taking a look at the doc to understand the feature in more detail.

Track Phone Number Country Location using Python
In this tutorial we will learn how can we get the country of any phone numbers using python.

We need one external module “phonenumbers”.

to install phonenumbers type “pip install phonenumbers” in your terminal.

Code==

import phonenumbers
from phonenumbers import geocoder
phone_number1 = phonenumbers.parse(“+12136574429”)
phone_number2 = phonenumbers.parse(“+917294536271”)
phone_number3 = phonenumbers.parse(“+862234567890”)
phone_number4 = phonenumbers.parse(“+201234567890”)
print(geocoder.description_for_number(phone_number1,’en’))
print(geocoder.description_for_number(phone_number2,’en’))
print(geocoder.description_for_number(phone_number3,’en’))
print(geocoder.description_for_number(phone_number4,’en’))

use below python script to Automating Facebook Post Using Python
def fetch_articles(session, search_query):

SEARCH_URL = 'https://www.mydealz.de/search'
SEARCH_DATA = {'q': search_query}
search_request = session.get(url=SEARCH_URL, params=SEARCH_DATA)
response = BeautifulSoup(search_request.text, 'lxml')
articles = response.select('article.thread')
articles_objects = []
for article in articles: title = article.select('div.threadGrid-title .thread-title a')[0]['title']
description = article.select('div.cept-description-container')[0].text
link = article.select('div.threadGrid-title .thread-title a')[0]['href']
articles_objects.append({
'title': title,
'description': description,
'link': link,
})
return articles_objects

Command Line Argument -affirm.y name
Command Line Argument in python w3schools
The affirm.y program has a few options to say nice things about a name. Here are three runs of the program in the command line. What the user types is in bold, followed by the program’s printed output.

$ python3 affirm.y -affirm Lisa
Everything is coming up Lisa
$ python3 affirm.y -affirm Bart
Looking good Bart
$ python3 affirm.y -affirm Maggie
Today is the day for Maggie
$
Command line arguments, or “args”, are extra information typed on the line when a program is run. The system is deceptively simple — the command line arguments are the words typed after the affirm.y on the command line, separated from each other by spaces. So in the first in this command line:
$ python3affirm.y -affirm Lisa

Backtworace

I am founder of <a href=”https://pythonslearning.com”>pythonslearning</a>

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store