file detection Flashcards

1
Q

useful module name:

A

os

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

when defining a path to a variable how many slashes should there between each child slash?

A

2 (\)

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

what is a dir(directory)?

A

a folder

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

Using the module “os” how do you read a text file

A

With open(‘file name’) as file:
Print(file.read())

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

How do you write a file using the “os” module?

A

By changing the ‘r’ argument to a ‘w’ argument

And using the function

File.write(text)

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

Copyfile()

A

Copies contents of a file

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

Copy()

A

Copyfile() + permission mode + destination can be directory

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

Copy2()

A

Copy() + copies metadata (files creation and modification times)

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

module you use to use to copy files

A

Shutil module

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

Arguments in copyfile()

A

Src,dst
(Arguments in this function)

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

Deleting a file using the os module

A

os.remove()

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

os.remove()

A

Deletes a file

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

os.rmdir()

A

Deletes an empty directory

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

Shutil.rmtree()

A

Delete a directory and the files it contains

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