Reading and Writing Files with Python Intro
Flashcard
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Easy
Wayground Content
Used 1+ times
FREE Resource
Student preview

9 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What is the correct way to open the file file_in.txt for reading? Options: open('file_in.txt', 'r'), open('file_in.txt','r+'), open('file_in.txt','w'), open('file_in.txt','a')
Back
open('file_in.txt', 'r')
2.
FLASHCARD QUESTION
Front
What is the best way to read an entire file into a single string?
Back
.read()
3.
FLASHCARD QUESTION
Front
What is the best way to read the first line of a file? Options: .read(), .readline(), .readlines(), .read(all)
Back
.readline()
4.
FLASHCARD QUESTION
Front
When reading text files, what are the hidden characters typically at the end of each line? Options:
, #, @, »
Back
\n
5.
FLASHCARD QUESTION
Front
Which is the best type of loop to write a file in? Options: While loop, for loop, repeat loop
Back
for loop
6.
FLASHCARD QUESTION
Front
What command can you use to separate parts of a line? Options: separate(), split(), divide(), cut()
Back
split()
7.
FLASHCARD QUESTION
Front
If I want to add to the end of a text file, I should: MyCipher = open("MyCipher.txt", "a")
Back
MyCipher = open("MyCipher.txt", "a")
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
4 questions
Hairstyle Descriptions
Flashcard
•
9th - 12th Grade
10 questions
Checking in at the airport
Flashcard
•
KG - University
12 questions
TỪ VỰNG BÀI 1 (B1)
Flashcard
•
KG
10 questions
Strategies to Avoid Communication Breakdown
Flashcard
•
11th - 12th Grade
10 questions
Present Simple
Flashcard
•
7th - 12th Grade
10 questions
Deviance in Sport
Flashcard
•
11th - 12th Grade
6 questions
ヴェルサイユ・ワシントン体制まとめ
Flashcard
•
9th - 12th Grade
12 questions
QUALITATIVE AND QUANTITATIVE RESEARCH
Flashcard
•
10th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade