Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Malware / Trojaner / VirenRatHat Android Malware Uses AI to Target Banking Credentials in Real Time(22.09.2026 um 19:02 Uhr)
Malware / Trojaner / VirenIT Security News Hourly Summary 2026-09-22 19h : 10 posts(22.09.2026 um 19:00 Uhr)
IT Security NachrichtenCyberattack Hits University of Munich, Exposing Student Data(22.09.2026 um 19:02 Uhr)
IT Security NachrichtenGemini AI Autonomously Hacked 3 Companies, Google Confirms(22.09.2026 um 19:00 Uhr)
Malware / Trojaner / VirenRatHat Android Malware Uses AI to Target Banking Credentials in Real Time(22.09.2026 um 19:02 Uhr)
Malware / Trojaner / VirenIT Security News Hourly Summary 2026-09-22 19h : 10 posts(22.09.2026 um 19:00 Uhr)
IT Security NachrichtenCyberattack Hits University of Munich, Exposing Student Data(22.09.2026 um 19:02 Uhr)
IT Security NachrichtenGemini AI Autonomously Hacked 3 Companies, Google Confirms(22.09.2026 um 19:00 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

itertools in Python (10)

Buy Me a Coffee☕ *Memo: My post explains itertools about count(), cycle() and repeat(). permutations() can return the iterator which permutates the elements of iterable one by one to return a tuple of zero or more elements one by one …

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Buy Me a Coffee



*Memo:





permutations() can return the iterator which permutates the elements of iterable one by one to return a tuple of zero or more elements one by one as shown below:



*Memo:




  • The 1st argument is iterable(Required-Type:Iterable).

  • The 2nd argument is r(Optional-Default:None-Type:int or NoneType):


    • It's the length of the returned tuple.

    • If it's None or not set, the length of iterable is used.

    • It must be 0 <= x.









from itertools import permutations

v = permutations(iterable='')
v = permutations(iterable='', r=None)
v = permutations(iterable='', r=0)
v = permutations(iterable=[])

print(v)
# <itertools.permutations object at 0x000001BE9908AE30>

print(next(v)) # ()
print(next(v)) # StopIteration:









from itertools import permutations

v = permutations(iterable='A')
v = permutations(iterable='A', r=1)
v = permutations(iterable=['A'])

print(next(v)) # ('A',)
print(next(v)) # StopIteration:









from itertools import permutations

v = permutations(iterable='AB')
v = permutations(iterable='AB', r=2)
v = permutations(iterable=['A', 'B'])

print(next(v)) # ('A', 'B')
print(next(v)) # ('B', 'A')
print(next(v)) # StopIteration:









from itertools import permutations

v = permutations(iterable='ABC')
v = permutations(iterable='ABC', r=3)
v = permutations(iterable=['A', 'B', 'C'])

print(next(v)) # ('A', 'B', 'C')
print(next(v)) # ('A', 'C', 'B')
print(next(v)) # ('B', 'A', 'C')
print(next(v)) # ('B', 'C', 'A')
print(next(v)) # ('C', 'A', 'B')
print(next(v)) # ('C', 'B', 'A')
print(next(v)) # StopIteration:









from itertools import permutations

for x in permutations(iterable='ABCD'):
# for x in permutations(iterable='ABCD', r=4):
# for x in permutations(iterable=['A', 'B', 'C', 'D']):
print(x)
# ('A', 'B', 'C', 'D')
# ('A', 'B', 'D', 'C')
# ('A', 'C', 'B', 'D')
# ('A', 'C', 'D', 'B')
# ('A', 'D', 'B', 'C')
# ('A', 'D', 'C', 'B')
# ('B', 'A', 'C', 'D')
# ('B', 'A', 'D', 'C')
# ('B', 'C', 'A', 'D')
# ('B', 'C', 'D', 'A')
# ('B', 'D', 'A', 'C')
# ('B', 'D', 'C', 'A')
# ('C', 'A', 'B', 'D')
# ('C', 'A', 'D', 'B')
# ('C', 'B', 'A', 'D')
# ('C', 'B', 'D', 'A')
# ('C', 'D', 'A', 'B')
# ('C', 'D', 'B', 'A')
# ('D', 'A', 'B', 'C')
# ('D', 'A', 'C', 'B')
# ('D', 'B', 'A', 'C')
# ('D', 'B', 'C', 'A')
# ('D', 'C', 'A', 'B')
# ('D', 'C', 'B', 'A')









from itertools import permutations

for x in permutations(iterable='ABCD', r=3):
# for x in permutations(iterable=['A', 'B', 'C', 'D'], r=3):
print(x)
# ('A', 'B', 'C')
# ('A', 'B', 'D')
# ('A', 'C', 'B')
# ('A', 'C', 'D')
# ('A', 'D', 'B')
# ('A', 'D', 'C')
# ('B', 'A', 'C')
# ('B', 'A', 'D')
# ('B', 'C', 'A')
# ('B', 'C', 'D')
# ('B', 'D', 'A')
# ('B', 'D', 'C')
# ('C', 'A', 'B')
# ('C', 'A', 'D')
# ('C', 'B', 'A')
# ('C', 'B', 'D')
# ('C', 'D', 'A')
# ('C', 'D', 'B')
# ('D', 'A', 'B')
# ('D', 'A', 'C')
# ('D', 'B', 'A')
# ('D', 'B', 'C')
# ('D', 'C', 'A')
# ('D', 'C', 'B')









from itertools import permutations

for x in permutations(iterable='ABCD', r=2):
# for x in permutations(iterable=['A', 'B', 'C', 'D'], r=2):
print(x)
# ('A', 'B')
# ('A', 'C')
# ('A', 'D')
# ('B', 'A')
# ('B', 'C')
# ('B', 'D')
# ('C', 'A')
# ('C', 'B')
# ('C', 'D')
# ('D', 'A')
# ('D', 'B')
# ('D', 'C')









from itertools import permutations

for x in permutations(iterable='ABCD', r=1):
# for x in permutations(iterable=['A', 'B', 'C', 'D'], r=1):
print(x)
# ('A',)
# ('B',)
# ('C',)
# ('D',)









from itertools import permutations

for x in permutations(iterable='ABCD', r=0):
# for x in permutations(iterable=['A', 'B', 'C', 'D'], r=0):
print(x)
# ()









from itertools import permutations

for x in permutations(iterable='ABCD', r=5):
# for x in permutations(iterable=['A', 'B', 'C', 'D'], r=5):
print(x)
# Nothing


Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten itertools in Python (10)

Thematisch verwandte Begriffe: itertools, Python · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94127 | When a BIG-IP APM access policy and an OAuth profile is configured on a …
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick