File reading and writing Flashcards

1
Q

How to open a file and print its contents

A

with open(‘testing.txt.txt’) as file:
print(file.read())

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

how to check if file is closed

A

print(file.closed)

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

what are the different modes

A

‘r’ for reading
‘w’ for writing
‘a’ for appending

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