listdir Questions

9

Solved

I'm trying to get the list of files in a particular directory and count the number of files in the directory. I always get the following error: WindowsError: [Error 3] The system cannot find the p...
Grouchy asked 16/3, 2013 at 17:5

4

Solved

How do I get a list of all the font names that are on my computer's system?
Gautious asked 25/9, 2020 at 19:5

6

Solved

Consider the following piece of code: files = sorted(os.listdir('dumps'), key=os.path.getctime) The objective is to sort the listed files based on the creation time. However since the the os.lis...
Delubrum asked 4/9, 2014 at 5:11

14

Solved

I often use python to process directories of data. Recently, I have noticed that the default order of the lists has changed to something almost nonsensical. For example, if I am in a current direct...
Osteopath asked 27/1, 2011 at 5:30

1

I tried to optimize a file browsing function written in Python, on Windows, by using os.scandir() instead of os.listdir(). However, time remains unchanged, about 2 minutes and a half, and I can't t...
Interfere asked 10/12, 2019 at 13:49

2

Solved

When performing the following code, is there an order in which Python loops through files in the provided directory? Is it alphabetical? How do I go about establishing an order these files ar...
Dimitri asked 13/6, 2017 at 22:33

2

Solved

I'm trying to do this: import os [x for x in os.listdir('.') if os.path.isfile(x)] [x for x in os.listdir('dirname') if os.path.isfile(x)] [x for x in os.listdir(os.path.abspath('dirname')) if os....
Mercie asked 22/8, 2015 at 14:19
1

© 2022 - 2024 — McMap. All rights reserved.