📌  相关文章
📜  python 检查文件扩展名 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:16.591000             🧑  作者: Mango

代码示例1
# 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