Back to marketplace
Python File Handling
No description yet. This curated deck is ready for daily study.
Total cards: 6•Content version: v4•Public deck•Updated: 8/1/2026
Card preview (6)
#1
Front (Question)
Name the different modes for file handling
Back (Answer)
“r” = read (Default) “w” = write (Overwrites file entirely) “a” = append (Adds to the end) “x” = Create new file (Fails if one with the same name already exists) In these flashcards a / suggests that any one of the modes listed could be sued to complete that action (but in different modes obviously)
#2
Front (Question)
How do you create a file in python?
Back (Answer)
variable = open(“file_name”, “w/a/x”)
#3
Front (Question)
How do you open a file in python?
Back (Answer)
variable_file = open(“file_name”, “r/w/a/x”)
#4
Front (Question)
How do you close a file in python?
Back (Answer)
variable_file.close()
#5
Front (Question)
How do you read a file in python?
Back (Answer)
variable_reading = variable_file.read()
#6
Front (Question)
How do you write to a file in python?
Back (Answer)
variable_file.write(“example”)