
Year 10 Text Files
Presentation
•
Computers
•
10th Grade
•
Medium
Roy Duguid
Used 13+ times
FREE Resource
15 Slides • 6 Questions
1
Do Now:
Paper 1 - programming > Reading and Writing to files > Do Now
2
Big Question: How can we use Python to read from and write to text files efficiently?
Lesson Objectives:
Understand the structure and purpose of text files. Learn how to read data from a text file using Python.
Gain proficiency in writing data to a text file using Python.
Develop error handling skills when working with text files.
Apply file handling techniques to solve practical problems.
Key words:
Text files, Read, Write, File handling, Open() Modes (read, write, append), Error handling, Data manipulation
3
4
5
6
7
8
9
10
11
14
Questions ahead...
15
Multiple Choice
This command will open file = open("mytext.txt", "r")
To read the file
To append to the file
To write to the file
16
Multiple Choice
This command will open file = open("mytext.txt", "w")
To read the file
To append to the file
To write to the file
17
Multiple Choice
If I want to add to the end of a text file, I should:
file = open("file.txt", "w")
file = open("file.txt", "a")
file = open("file.txt", "w+")
file = open("file.txt", "s")
18
Multiple Select
Which of these will generate an error?
file.write("writing")
file..write(writing)
file.write("writing",writing)
file.writetofile()
19
Multiple Select
How do you close the file?
file = close
file.close
close = file()
20
Multiple Select
Why do we close txt files after we are done with them?
This frees up any memory used by having it open
It makes no difference if its closed or not
Once closed, the file cannot be read from or written to without opening it again
It's easier to write to once it's closed
21
Go to class notebook
Complete challenges
Do Now:
Paper 1 - programming > Reading and Writing to files > Do Now
Show answer
Auto Play
Slide 1 / 21
SLIDE
Similar Resources on Wayground
14 questions
Who or Whom?
Lesson
•
10th Grade
19 questions
R081 - Naming Conventions
Lesson
•
10th Grade
13 questions
Storage Devices
Lesson
•
10th Grade
19 questions
Parts of the motherboard
Lesson
•
10th Grade
16 questions
Sex-linked traits
Lesson
•
10th Grade
15 questions
Velocity Time Graphs
Lesson
•
10th Grade
15 questions
Revising
Lesson
•
10th Grade
17 questions
Alcohol
Lesson
•
10th Grade
Popular Resources on Wayground
10 questions
5.P.1.3 Distance/Time Graphs
Quiz
•
5th Grade
10 questions
Fire Drill
Quiz
•
2nd - 5th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
15 questions
Hargrett House Quiz: Community & Service
Quiz
•
5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade