Read many images in a folder by using python [closed] - python

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

Related

Jupyter Notebooks: Trouble reading cvs file in Python [closed]

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 1 year ago.
Improve this question
I have trouble reading this csv file downloaded from kaggle. I have tried using the utf-8 encoding and it was still not able to read the csv file
There might be some special characters in the file.
import pandas as pd
df = pd.read_csv(r"file_path", encoding="latin1")
with open('filename.csv') as file_info:
print(file_info)
The encoding will be at the end.
data=pd.read_csv('filename.csv', encoding="encoding from file_info")
Works every time.

Glob not getting files? [closed]

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/*

How to have a % in a python statement without using two % [closed]

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
so my python application opens a link that would be found in my config file. I would like to make it so it would like to allow it to go to the website without doubling the %. Heres what I would want config.get('CONFIG', 'Website') the web address has a bunch of %'s in the link but when I run it, the process ends
I'm assuming you are using the configparser module?
If so, you can use ConfigParser(interpolation=None) to disable string interpolation (which controls the behavior of % characters in the config file).
(Or on older versions of Python, you may need to use RawConfigParser instead.)

Start script from different file directory using QProcess.start() [closed]

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"

How to get a specific with glob function python? [closed]

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?

Categories

Resources