🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsK-Lite Mega Codec Pack(12.09.2026 um 12:00 Uhr)
🕵️ SicherheitslückenDefender 0-Day ShieldBreak (CVE-2026-69414) nicht sauber gepatcht - BornCity(11.09.2026 um 12:52 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsK-Lite Mega Codec Pack(12.09.2026 um 12:00 Uhr)
🕵️ SicherheitslückenDefender 0-Day ShieldBreak (CVE-2026-69414) nicht sauber gepatcht - BornCity(11.09.2026 um 12:52 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

Mastering Python Lists: Essential Techniques You Need to Know

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




For






simple for



This will loop through the list and each element of the list will be available as a variable in every iteration. This is widely used when there is a need to go over all the elements of the list.




CODE
operating_systems = ["windows", "mac", "linux"]
for os in operating_systems:
print(os)`










CODE
# Output
windows
mac
linux









for and range



When there is need for accessing based on index and index value is required.




CODE
operating_systems = ["windows", "mac", "linux"]
for i in range(len(operating_systems)):
print(f"Index {i}: {operating_systems[i]}")









CODE
# Output
Index 0: windows
Index 1: mac
Index 2: linux









for and enumerate



This is an elegant way, if you need both index and the value




CODE
operating_systems = ["windows", "mac", "linux"]
for index, os in enumerate(operating_systems):
print(f"Index is {index} and value is {os}")









CODE
# Output
Index is 0 and value is windows
Index is 1 and value is mac
Index is 2 and value is linux









While






simple while






CODE
operating_systems = ["windows", "mac", "linux"]
i = 0 # Inital condition, required to start
while i < len(operating_systems):
print(f"While looping {i} got the value {operating_systems[i]}")
i = i + 1 # This is very important, dont forget about infinite loops









CODE
# Output
While looping 0 got the value windows
While looping 1 got the value mac
While looping 2 got the value linux









Iterator



Gives fine control over when to move the iterator forward, though we have to rely on the StopIteration to check if the end is reached.




CODE
operating_systems = ["windows", "mac", "linux"]
iterator = iter(operating_systems)
while True:
try:
os = next(iterator)
print(f"Consumed form iterator {os}")
except StopIteration:
print("Consumed all from iterator")
break









CODE
# Output
Consumed form iterator windows
Consumed form iterator mac
Consumed form iterator linux
Consumed all from iterator









CODE
# Hack to avoid StopIteration
iterator = iter(operating_systems)
end_of_list = object()
reached_end = False
while not reached_end:
os = next(iterator, end_of_list)# a predefined object as end of the list
if os != end_of_list:
print(os)
else:
reached_end = True









List comprehension



When transformation is required




CODE
operating_systems = ["windows", "mac", "linux"]
os_uppercase = [os.upper() for os in operating_systems]
print(os_uppercase)









CODE
# Output
['WINDOWS', 'MAC', 'LINUX']









Cycling



When cycling through a list is require. Use with proper boundary condition to break the loop




CODE
import itertools
operating_systems = ["windows", "mac", "linux"]
for item in itertools.cycle(operating_systems):
print(item)
# Infinite cycling loopmake sure to have proper boundary condition to break









CODE
# Output
windows
mac
linux
windows
mac
linux
windows
mac
linux
windows
mac
linux
windows ....... Infinite loop









Over multiple lists



Simultaneously loop over multiple lists. Note the output if the list sizes are different.




CODE
operating_systems = ["windows", "mac", "linux"]
mobile_operating_systems = ["android", "ios"]

for os, mobile_os in zip(operating_systems,mobile_operating_systems):
print(os, mobile_os)









CODE
# Output
windows android
mac ios









Loop in reverse






CODE
operating_systems = ["windows", "mac", "linux"]
for reversed_os in reversed(operating_systems):
print(reversed_os)









CODE
# Output
linux
mac
windows


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
4 Quellen
CVE-2026-71328 | Microsoft .NET/Visual Studio buffer overflow (Nessus ID 344808)
3 Quellen
CVE-2026-65669 | Microsoft SQL Server up to 22.8.1 injection (Nessus ID 344797)
1 Quelle
CVE-2026-75650 | Adobe Commerce/Commerce B2B/Magento Open Source Template Engine StyleSmuggler neutralization (EUVD-2026-72530 / Nessus ID 344801)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Mastering Python Lists: Essential Techniques You Need to Know

Thematisch verwandte Begriffe: Mastering, Python, Lists, Essential · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...