mardi 18 avril 2017

Pattern test for string ending in Python

In Python, how to make a pattern test for a string ending. So just something like:

"name.txt"=="*.txt"

I tried to use the re library:

pattern = re.compile("*.txt")
pattern.match("somename.txt")

But the obvious seems not to work. Could someone paste his code? Please no link to the re libray reference. For today I am messed up with that. Thank you guys!

Aucun commentaire:

Enregistrer un commentaire