Vernon Cole wrote:
> 2) I suspect that Python is NOT returning question mark characters.
> Windows (or KIMODO) is probably failing to display some characters
> that Python is returning.
Actually, you're wrong here. The Windows API is returning the file
names in Unicode. The "os.listdir" function
1) Comparing the time it would take to walk a directory tree thousands
of times, with the storage it would take to store thousands of file
names, I think you would be much better of to store the list. Buy
another memory chip if needed.
2) I suspect that Python is NOT returning question mark chara
venu madhav wrote:
Hello,
First of all thanks for your response. I've written a function
as shown below to recurse a directory and return a file based on the
value of n. I am calling this fucntion from my main code to catch that
filename. The folder which it recurses through contains
Thank you very much for your timely replies. They were really helpful in
making my work easier. But the main issue which I am facing is that if the
file has name has some Unicode charactes (Arabic, Russian etc), this python
interpreter is failing to detect those and inturn returning "???" in place
ok, I understand better now, some more points.
You need to handle the case that it doesn't find the file after the
for loop, one source of a None return.
also as mentioned in point 2 when recursing you need to return the result so:
if os.path.isdir(full_path):
findFile(full_pa
Hello,The value of n is initialized in the main procedure which
calls it. Basically I am trying to find the n'th file in the directory(can
be in its sub directories too). As I've given the previous mail itself
file = findFile(path)
invokes that function.Whe
I see a couple of problems with your code:
1. where is n first given a value and what is it total file count,
etc? also you decrement the value, do you want the last file in the
directory or something?
2. The if os.path.isdir(full_path): .. findFile(full_path) part
doesn't return or handle the val
Hello,First of all thanks for your response. I've written a function
as shown below to recurse a directory and return a file based on the value
of n. I am calling this fucntion from my main code to catch that filename.
The folder which it recurses through contains a folder having files with