fork download
  1. # create a list of strings
  2. my_list = ["file1.tptprj", "file2.tptprj", "file3", "file4.tptprj"]
  3.  
  4. # iterate through the list
  5. for item in my_list:
  6. # check if the item has an extension
  7. if "." in item:
  8. # check if the extension is ".tptprj"
  9. if item.endswith(".tptprj"):
  10. # print "matrix"
  11. print("source")
  12. else:
  13. # print "source"
  14. print("matrix")
  15.  
Success #stdin #stdout 0.01s 6996KB
stdin
Standard input is empty
stdout
source
source
matrix
source