Thanks for the clarification.
I see:
1/
%%time
for e in os.scandit('.'):
print(e)
--> 14ms
2/
%%time
for e in os.listdir('.'):
print(e)
--> 16ms
3/
%%time
for e in os.listdir('.'):
os.path.isdir(e)
print(e)
--> 1.03s
Much longer !
Maybe this, combined with a parasite antivirus, makes it dog slow...?
On Wednesday, October 26, 2016 at 11:08:46 PM UTC+2, takowl wrote:
>
> On 26 October 2016 at 20:37, oscar6echo <[email protected]
> <javascript:>> wrote:
>
>>
>> 2/
>>
>> for e in os.listdir('.'):
>>
>> print(e)
>>
>
> Can you try something like this:
>
> for e in os.listdir('.'):
> os.path.isdir(e)
> print(e)
>
> listdir() itself is probably not making it slow, it's listdir and then
> doing things with each file that's the issue. scandir returns results with
> a bit more information, so it doesn't necessarily have to go back to the
> operating system to check 'is this a directory'.
>
> Thomas
>
--
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/c744a856-11f7-4efe-96e8-b229af237eec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.