Learn Python Coding
40.1K subscribers
679 photos
34 videos
24 files
473 links
Learn Python through simple, practical examples and real coding ideas. Clear explanations, useful snippets, and hands-on learning for anyone starting or improving their programming skills.

Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
Python allows you to create enumerations that are also regular strings!

Previously, when working with APIs, JSON, and configurations, it was often necessary to manually extract the value from an Enum.

For example:
class Status(Enum):
ACTIVE = "active"

When serializing, you would get an enumeration object:
Status.ACTIVE

rather than a regular string:
"active"

In Python 3.11, StrEnum was introduced to solve this problem.
from enum import StrEnum

class Status(StrEnum):
ACTIVE = "active"
BLOCKED = "blocked"

Now, the value can be used wherever a string is expected:
json.dumps({"status": Status.ACTIVE})

The result:
{"status": "active"}

At the same time, the advantages of enumerations are preserved:
Status.ACTIVE
Status.BLOCKED

You cannot accidentally pass an incorrect value:
Status("unknown")

will result in an error.

🔥 StrEnum allows you to combine the strict typing of enumerations with the convenience of regular strings, without manual conversion when working with APIs, JSON, and configurations.

#Python #Coding #StrEnum #DevTips #Programming #Python311

Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
4
How to check if a string is printable in Python 🤯

>>> "123".isprintable()
True

>>> "abc".isprintable()
True

>>> "\t
".isprintable()
False

# Python string method .isprintable()
>>> "123".isprintable()
True
>>> "abc".isprintable()
True
>>> "\t
".isprintable()
False

#Python #Programming #Coding #Tutorial #Tech #Dev

Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
5
collections.ChainMap — a built-in Python class that combines multiple dictionaries or other mappings into a single, updatable view. 🧠

Instead of merging dictionaries and creating new data structures in memory, it links them by reference, allowing you to search and manage them as a single entity. 🔗

# Example usage of collections.ChainMap
from collections import ChainMap

dict1 = {'a': 1, 'b': 2}
dict2 = {'b': 3, 'c': 4}
combined = ChainMap(dict1, dict2)
print(combined['b']) # Output: 2

#Python #Coding #DataStructures #Programming #Tech #DevTools

Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
3
Function

pprint()
pprint()

is designed for pretty-printed, formatted output in Python. 🐍

It automatically formats complex data structures, such as nested lists, dictionaries, and tuples, by adding indentation and line breaks for improved readability.

Features:
• Supports customization of the output width for convenient formatting.
• Includes depth and compact parameters to control the level of nesting and display compactness.
• Available through the standard pprint module in the Python library. 💻

#Python #Programming #Code #Developer #Tech #Scripting

Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

⭐️ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
6👍1
httptap

This is a command-line tool that breaks down an HTTP request into individual stages: DNS resolution, TCP connection, TLS handshake, and data transfer.

It generates a detailed waterfall timeline, which allows you to quickly identify which stage of the request is causing the delay.

📁 Language: #Python 99%

⭐️ Stars: 526

More: https://github.com/ozeranskii/httptap
2
🔥 Land Your Dream Job – Free Interview Prep Resources Inside!

🌈Struggling with tough interview questions? Nervous about technical grilling? You're not alone.

We've just released a bunch of 100% free interview prep kits for 2026 – covering common Q&As, behavioral questions, technical deep-dives, and role-specific tips for #Cisco, #AWS, #PMP, #AI, #Python, #Excel, and #Cybersecurity.

💥No signup traps, no hidden fees – just click and download.

🎯 Interview Question Bank → https://bit.ly/4xzKG0o
📘 Free Cert E‑Book → https://bit.ly/4zffDZp
🪜 Free Online Course → https://bit.ly/3TPLkbl
☁️ Free AI Materials → https://bit.ly/4q7T7gR
📊 Cloud Study Guide → https://bit.ly/4wbsjgV

Tag a friend who's also job-hunting – Ace together! 💪

🌐 Join the community: https://chat.whatsapp.com/FQOG04r9xSiIa2ElhaNUJU
🌐Join SPOTO telegram Group: https://xn--r1a.website/spotoITstudygroup
📲 Need personalized help? → https://wa.link/1zrbdh
1