Work with file Flashcards

1
Q

close

A

Close the file

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

read

A

Read content of the file, can assign it to a variable or print it

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

readline

A

Read first line of the file

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

truncate

A

Empties the file

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

write(“stuff”)

A

Write “stuff” to the file

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

seek(0)

A

Moves the read/write location to beginning of the file.

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

read(5)

A

read first 5 letters of the file

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

open(filename, ‘r’)

A

open the file, read only, assign to a file object

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

readlines()

A

Read all lines of the file, store as a list of string (each line)

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