Python File Methods Flashcards

1
Q

close()

A

Closes the file

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

detach()

A

Returns the separated raw stream from the buffer

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

fileno()

A

Returns a number that represents the stream, from the operating system’s perspective

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

flush()

A

Flushes the internal buffer

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

isatty()

A

Returns whether the file stream is interactive or not

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

read()

A

Returns the file content

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

readable()

A

Returns whether the file stream can be read or not

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

readline()

A

Returns one line from the file

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

readlines()

A

Returns a list of lines from the file

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

seek()

A

Change the file position

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

seekable()

A

Returns whether the file allows us to change the file position

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

tell()

A

Returns the current file position

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

truncate()

A

Resizes the file to a specified size

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

writable()

A

Returns whether the file can be written to or not

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

write()

A

Writes the specified string to the file

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

writelines()

A

Writes a list of strings to the file