Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am trying to get all the arxml file in the subfolders but it is only showing the files in the respective path I gave.
path = r"D:\git\Master"
arxml_files = glob.glob(os.path.join(path, "**", "*.arxml"))
But the arxml_files only contains the files of the path and it might have subfolders which i want to collect as well.
Duplicate to How to use glob() to find files recursively?
See How to use glob() to find files recursively?
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 months ago.
Improve this question
I want to print the file path for the files and not directories located in nested folders using pandas. The path where the folder is located changes. The code should read the dynamic file path and print the path where the csv files are stored.
You can use the os library with the method walk.
You have few examples here:
read all files in sub folder with pandas
Do I understand os.walk right?
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am trying to use Glob to get files in a directory. I am learning how to use it through this. My code should (so far) be able to print out all of the files in the files directory. But instead it is just printing out ['files'].
My code is at #EvokerKing/JSON on repl.it.
I guess you want to do this
import json
import glob
fileList = glob.glob("files/*")
print(fileList)
for finding the files under files folder you need to use files/*
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have tried looking this up, but for some reason I cannot find anything about it. How do I run a script by giving the particular file directory in start()?
This works (when Test is in the same folder as the main script):
self.process.start("python3 Test.py")
This does NOT work:
self.process.start("python3 /my/path/Test.py")
Try this:
self.process.start("python3 ../my/path/Test.py") # added two periods before "/m"
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I want to select the files, whose names ends with _90.jpeg|_180.jpeg|_270.jpeg|_90.jpg|_180.jpg|_270.jpg.
currently I am using the following approach
pattern = re.compile('_90.jpeg|_180.jpeg|_270.jpeg|_90.jpg|_180.jpg|_270.jpg')
pattern.search(filename)
Is there any cleaner way to represent the _xxx.yyyy in regular expression.
You can use:
pattern = re.compile('(_9|_18|_27)0\.jpe?g$')
If any digits are fine:
pattern = re.compile('_\d+\.jpe?g$')
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm using python for the first time : I have a folder that contains hundred of images and i need to read the time of each on.
I know how to read the time of an image but i dont know how to open each image in this folder by order.
thanks for helping
If you want to print them in alphabetical order, you can use the following code. With if file.endswith(".png") you will only get .png files. This is good if you have any other type of files in the same directory.
import os, os.path, time
for file in os.listdir("/folder_name"):
if file.endswith(".png"):
print str(file) + " - Creation date: " + str(time.ctime(os.path.getctime(file)))
Output:
IMG_01.png - Creation date: Thu Nov 12 09:33:13 2015