file detection Flashcards

1
Q

what is the import function required

A

import os

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

function to detect if a files path exists

A

if os.path.exists(path):

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

functino to detect if the path is a file

A

if os.path.isfile(path):

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

funciton to detect if path is a directory

A

elif os.path.isdir(path):

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly