Glob not getting files? [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 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/*

Related

Get the file path for files in nested folders using python pandas [closed]

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?

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.

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?

Read many images in a folder by using 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 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

Categories

Resources