Python Check Plik rozszerzenia pliku

# Checking for single extension (.txt) of file
if file.endswith(".txt"):
  # do something
  
# Checking multiple extensions (.txt, .pdf, .mp3, ...)
if file.endswith((".txt", ".pdf", ".mp3")):
  # do something
Soggy Boi