Telegram Web
⚠️ Daily Dose of Python ⚠️

Merging/Upserting two dictionaries.

>>> a = {"a":1, "b":1}
>>> b = {"b":2, "c":1}
>>> a.update(b)
>>> a
{"a":1, "b":2, "c":1}

- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Naming and saving slices of iterables.

# Naming slices (slice(start, end, step))
>>> a = [0, 1, 2, 3, 4, 5]
>>> LASTTHREE = slice(-3, None)
>>> LASTTHREE
slice(-3, None, None)
>>> a[LASTTHREE]
[3, 4, 5]


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Finding the index of an item in a list.

>>> a = ["foo", "bar", "baz"]
>>> a.index("bar")
1


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Removing useless characters on the end/start/both of your string.

>>> name = "//George//"
>>> name.strip("/")
'George'
>>> name.rstrip("/")
'//George'
>>> name.lstrip("/")
'George//'


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Rotating iterable by k elements

>>> a = [1, 2, 3, 4]
>>> k = 2
>>> a[-2:] + a[:-2]
[3, 4, 1, 2]


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Reversing an iterable with order (string, list etc).

# Reversing string
>>> s = "abc"
>>> s[::-1]
"cba"

# Reversing list
>>> l = ["a", "b", "c"]
>>> l[::-1]
["c", "b", "a"]


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Multiple predicates short-cut.

>>> n = 10
>>> 1 < n < 20
True


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Trenary operator.

>>> "Python ROCK" if True else " I AM GRUMPY"
"Python ROCK"

- @pythonpool -
⚠️ Daily Dose of Python ⚠️

Try-catch-else construct.

try:
foo()
except Exception:
print("Exception occured")
else:
print("Exception didnt occur")
finally:
print("Always gets here")


- @pythonpool -
⚠️ Daily Dose of Python ⚠️

For-else construct useful when searched for something and find it.

# For example assume that I need to search through a list and process each item until a flag item is found and
# then stop processing. If the flag item is missing then an exception needs to be raised.

for i in mylist:
if i == theflag:
break
process(i)
else:
raise ValueError("List argument missing terminal flag.")

- @pythonpool -
⚠️ Daily Dose of Python ⚠️

List comprehension.

>>> m = [x ** 2 for x in range(5)]
>>> m
[0, 1, 4, 9, 16]


- @pythonpool -
😍UDEMY LEARN WEBSITE HACKING COURSE [1.87GB]😍


1️⃣ Preparation - Creating A Penetration Testing Lab
2️⃣ Prepataion - Linux Basics
3️⃣ Website Basics
4️⃣ Information Gathering

5️⃣ File Upload Vulnerabilities
6️⃣ Code Execution Vulnerabilities
7️⃣ Local File Inclusion Vulnerabilities
8️⃣ Remote Files Inclusion Vulnerabilities
9️⃣ SQL Injection Vulnerabilities
🔟 XSS Vulnerabilities
1️⃣1️⃣ Insecure Session Management

1️⃣2️⃣ Bruteforce Dictionary Attacks
1️⃣3️⃣ Discovering Vulnerabilities Automatically Using Owaps ZAP
1️⃣4️⃣ Post Exploitation
1️⃣5️⃣ Bonus Section

Download link:-
https://mega.nz/folder/3ipEGIzZ#VAvV7N8XZHD-sZ3RULvI9g

- @pythonpool -
2025/07/13 10:58:10
Back to Top
HTML Embed Code: