“Abzug eines Musters in Python” Code-Antworten

Abzug eines Musters in Python

pattern = "F-x-([EK])-x-S-([GT])-R-T"
pattern=pattern.replace("-","")
pattern=pattern.replace("x","[GPAVLIMCFYWHKRQNEDST]")
count=0

for sequence in source:
    count += 1
    sequence=sequence.replace(" ","")
    result = re.finditer(pattern, sequence)
    print(">sequence ",count)
    print(sequence)
    for match in result:
        print("found ",match.group()," at position",match.span()," third position =", match.group(2))
Aggressive Addax

Python -Muster -Matching -Beispiel

import re
pattern = re.compile('[a-zA-Z ]+')		# a...z A...Z and space allowed
message = "Weather is nice"
if pattern.match(message).group() == message:
    print("match")
else:
    print("no match")
VasteMonde

Ähnliche Antworten wie “Abzug eines Musters in Python”

Fragen ähnlich wie “Abzug eines Musters in Python”

Weitere verwandte Antworten zu “Abzug eines Musters in Python” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen