Featured Post

Python Regex: The 5 Exclusive Examples

Image
 Regular expressions (regex) are powerful tools for pattern matching and text manipulation in Python. Here are five Python regex examples with explanations: 01 Matching a Simple Pattern import re text = "Hello, World!" pattern = r"Hello" result = re.search(pattern, text) if result:     print("Pattern found:", result.group()) Output: Output: Pattern found: Hello This example searches for the pattern "Hello" in the text and prints it when found. 02 Matching Multiple Patterns import re text = "The quick brown fox jumps over the lazy dog." patterns = [r"fox", r"dog"] for pattern in patterns:     if re.search(pattern, text):         print(f"Pattern '{pattern}' found.") Output: Pattern 'fox' found. Pattern 'dog' found. It searches for both "fox" and "dog" patterns in the text and prints when they are found. 03 Matching Any Digit   import re text = "The price of the

Python: Store Multiple Values in a Variable

In Python, you can assign values to the variables. This post tells you how to assign values to multiple variables. It is common assigning values in any programming language. But Python simplifies your job by introducing this technic. Here is Python For Loop Tricky Example.

Python Assigning the Values At once.

a = 1
b = 1
c = 1
d = 1
or, you can assign simultaneously as;
a=b=c=d=1


Python Assigning Multiple Values at Once

Python Assigning Multiple Values at Once


The other way you can assign as;

a, b, c, d = 10, 1, 3.5, 'Srini'

From the above, you can understand as below:

The '10' assigns to a.
The '1' assigns to b.
The '3.5' assigns to c.
Then 'Srini' to d.

Comments

Popular posts from this blog

Explained Ideal Structure of Python Class

6 Python file Methods Real Usage

How to Decode TLV Quickly