
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
13 questions
Storage Devices
Presentation
•
10th Grade
19 questions
Parts of the motherboard
Presentation
•
10th Grade
16 questions
Sex-linked traits
Presentation
•
10th Grade
15 questions
Velocity Time Graphs
Presentation
•
10th Grade
15 questions
Revising
Presentation
•
10th Grade
17 questions
Alcohol
Presentation
•
10th Grade
14 questions
Who or Whom?
Presentation
•
10th Grade
19 questions
R081 - Naming Conventions
Presentation
•
10th Grade
Popular Resources on Wayground
10 questions
GPA Lesson
Presentation
•
9th - 12th Grade
7 questions
Albert Einstein
Quiz
•
3rd Grade
31 questions
Bridge A Review
Quiz
•
3rd Grade
6 questions
Blue Sue and Red Ruth
Quiz
•
3rd Grade
8 questions
(Day12 HW) Inverse Trig Ratios
Quiz
•
9th Grade
20 questions
Summer Geometry QUIZ (Week3)
Quiz
•
9th Grade
16 questions
Theme Practice
Quiz
•
7th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
Discover more resources for Computers
10 questions
GPA Lesson
Presentation
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
16 questions
Translations and Reflections
Quiz
•
9th - 10th Grade
17 questions
High School Survival Guide
Presentation
•
9th - 12th Grade
20 questions
Banking
Quiz
•
9th - 12th Grade
20 questions
Budgeting
Quiz
•
9th - 12th Grade