Python Forum
Counting the number of files related to particular format
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Counting the number of files related to particular format
#2
You can use glob module.
You could just pass a list of extensions and glob will do the rest.

import glob
img_files = []
for idx, img_ext in enumerate(["*.jpeg", "*.jpg", "*.JPG"]):
    img_files.extend(glob.glob(img_ext))
Reply


Messages In This Thread
RE: Counting the number of files related to particular format - by gontajones - Nov-05-2018, 07:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Read directory listing of files and parse out the highest number? cubangt 5 2,433 Sep-28-2022, 10:15 PM
Last Post: Larz60+
Photo How can I use 2 digits format for all the number? plumberpy 6 2,373 Aug-09-2021, 02:16 PM
Last Post: plumberpy
  Counting number of words and organize for the bigger frequencies to the small ones. valeriorsneto 1 1,707 Feb-05-2021, 03:49 PM
Last Post: perfringo
  Although this is a talib related Q it's mostly related to python module installing.. Evalias123 4 5,752 Jan-10-2021, 11:39 PM
Last Post: Evalias123
  Counting Number of Element in a smart way quest 2 2,033 Nov-09-2020, 10:24 PM
Last Post: quest
  multiple number format conversion oli_action 4 2,612 Aug-11-2020, 05:10 AM
Last Post: perfringo
  get method not counting number of strings in dictionary LearningTocode 2 2,135 Jun-13-2020, 11:17 PM
Last Post: LearningTocode
  counting items in a list of number combinations Dixon 2 2,096 Feb-19-2020, 07:06 PM
Last Post: Dixon
  Number format william888 3 2,852 Aug-23-2019, 05:33 AM
Last Post: ThomasL
  Counting number of occurrences of a single digit in a list python_newbie09 12 5,631 Aug-12-2019, 01:31 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020