SlideShare a Scribd company logo
XII. FILE PROCESSING
Engr. Ranel O. Padon
PYTHON PROGRAMMING TOPICS
I

• Introduction to Python Programming

II

• Python Basics

III

• Controlling the Program Flow

IV

• Program Components: Functions, Classes, Packages, and Modules

V

• Sequences (List and Tuples), and Dictionaries

VI

• Object-Based Programming: Classes and Objects

VII

• Customizing Classes and Operator Overloading

VIII

• Object-Oriented Programming: Inheritance and Polymorphism

IX

• Randomization Algorithms

X

• Exception Handling and Assertions

XI

• String Manipulation and Regular Expressions

XII

• File Handling and Processing

XIII

• GUI Programming Using Tkinter
Data Hierarchy

File
Processing

File-Open Modes
Dissecting Files
The Power of Buffering
Python Programming - XII. File Processing
FILE HANDLING

variables offer only temporary storage of data
they are lost when they “goes out of scope” or
when the program terminates
FILE HANDLING

files are used for long-term retention of
large amounts of data, even after the program
that created the data terminates.
data maintained in files is called persistent data
FILE HANDLING | Data Hierarchy

Bit (“Binary digit”) => the smallest computer data item
Bit is a digit that can assume one of two values
FILE HANDLING | Data Hierarchy

Programming with low-level bit formats is tedious & boring.
use decimal digits, letters, and symbols instead.
FILE HANDLING | Data Hierarchy

Characters are made-up of digits, letters, and characters.
Characters are represented as combination of bits (bytes).
FILE HANDLING | Data Hierarchy
FILE HANDLING | Data Hierarchy
Field (Column) is a collection of characters,
represented as words.
Record (Row) is a collection of fields,
represented as a tuple, dictionary, instance of a class.
File (Table) is a collection of records,
implemented as sequential access or random-access.
Database (Folder) is a collection of files,
handled by DBMS softwares.
FILE HANDLING | Data Hierarchy
FILE HANDLING | Data Hierarchy
FILE HANDLING | open() & close()
magical_file = open(“file_name.txt” [, a|r|r+|w|w+] [, buffer_mode])

magical_file.close()
FILE HANDLING | Other Functions
FILE HANDLING | open()

Open Mode

r
r+
w
w+
a
a+

Read

Write

Appends

Overwrites

Creates

Cursor @
Start

Cursor @
EOF
FILE HANDLING | Common Modes

Open Mode

r
w

Read

Write

Appends

Overwrites

Creates

Cursor @
Start

Cursor @
EOF
FILE HANDLING | open()
“r” is the default file-open mode
open(“input.dat”) = open(“input.dat”, “r”)
FILE HANDLING | r
FILE HANDLING | r
FILE HANDLING | r
FILE HANDLING | w

 try removing line #6
 try removing "n" in lines #3 and #4
FILE HANDLING | w
FILE HANDLING | with-as Keyword
FILE HANDLING | Parsing

Paninda.txt
FILE HANDLING | Parsing | split
FILE HANDLING | Parsing | split
FILE HANDLING | Parsing | csv

Paranormal_Sightings.csv
FILE HANDLING | Parsing | strip
FILE HANDLING | Parsing | strip
FILE HANDLING | Parsing & Classes
FILE HANDLING | Parsing & Classes
FILE HANDLING | Parsing & Classes
FILE HANDLING | Parsing & Classes 2
FILE HANDLING | Parsing & Classes 2
FILE HANDLING | Parsing & Classes 2
FILE HANDLING | Parsing & Classes 2
FILE HANDLING | HTML Parsing
MangJose.html
FILE HANDLING | HTML Parsing
MangJose.html
FILE HANDLING | HTML Parsing
FILE HANDLING | HTML Parsing
FILE HANDLING | HTML Parsing
FILE HANDLING | HTML Parsing
FILE HANDLING | HTML Parsing
FILE HANDLING | HTML Parsing
FILE HANDLING | r+, w+, a+
All of the "plus" modes allow reading and writing:
the main difference between them is where
we're positioned in the file.

“r+” puts us at the beginning
“w+” puts us at the beginning & the end,
because the file's truncated
“a+” puts us at the end.
FILE HANDLING | w+
FILE HANDLING | Buffering
FILE HANDLING | Buffering
“-1” is the default file-open buffering mode
open(“input.dat”) = open(“input.dat”, “r”, “-1”)
Flag

Meaning

0

unbuffered

1

buffered line

n

buffered with size n

-1

system default
FILE HANDLING | Creating A Big File!
FILE HANDLING | Unbuffered r
Then, let’s read that big file. 
FILE HANDLING | Buffered r
Now, with the help of buffering. 
FILE HANDLING | Buffered By Default

In other languages, like C or Java,
buffering is not the default mode.
FILE HANDLING | What else?
1. Random-Access Files: for fast searching/editing of records
* use the shelve module
* shelve.open()
2. Serialization: compressing file as objects for efficiency;
useful for transferring data (objects, sequences, etc)
across a network connection or saving states of a game
* use the pickle or cPickle module
* cPickle.dump(stringList_to_be_written, serialized_file)
* records = cPickle.load(serialized_file)
Python Programming - XII. File Processing
PRACTICE EXERCISE| MORSE CODE
PRACTICE EXERCISE| MC CHART
PRACTICE EXERCISE| MC CHART
PRACTICE EXERCISE| MORSE CODE

A. Read a file containing Filipino/English-language
phrases and encodes it into Morse code.
B. Read a Morse code file and converts it into the
Filipino/English-language equivalent.

Use one blank between each Morse-coded letter and
three blanks between each Morse-coded word.
REFERENCES
 Deitel, Deitel, Liperi, and Wiedermann - Python: How to Program (2001).

 Disclaimer: Most of the images/information used here have no proper source
citation, and I do not claim ownership of these either. I don’t want to reinvent the
wheel, and I just want to reuse and reintegrate materials that I think are useful or
cool, then present them in another light, form, or perspective. Moreover, the
images/information here are mainly used for illustration/educational purposes only,
in the spirit of openness of data, spreading light, and empowering people with
knowledge. 

More Related Content

PDF
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Ranel Padon
 
PPTX
11 Unit 1 Chapter 02 Python Fundamentals
Praveen M Jigajinni
 
PDF
Python libraries
Prof. Dr. K. Adisesha
 
PPTX
Python Session - 4
AnirudhaGaikwad4
 
PPTX
Introduction to Python Part-1
Devashish Kumar
 
PPTX
Python Session - 6
AnirudhaGaikwad4
 
PPTX
Introduction to Python programming Language
MansiSuthar3
 
PPT
358 33 powerpoint-slides_2-functions_chapter-2
sumitbardhan
 
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Ranel Padon
 
11 Unit 1 Chapter 02 Python Fundamentals
Praveen M Jigajinni
 
Python libraries
Prof. Dr. K. Adisesha
 
Python Session - 4
AnirudhaGaikwad4
 
Introduction to Python Part-1
Devashish Kumar
 
Python Session - 6
AnirudhaGaikwad4
 
Introduction to Python programming Language
MansiSuthar3
 
358 33 powerpoint-slides_2-functions_chapter-2
sumitbardhan
 

What's hot (20)

PDF
Python-01| Fundamentals
Mohd Sajjad
 
PDF
Java8
Felipe Mamud
 
PPTX
Python second ppt
RaginiJain21
 
PPTX
Functions in Python
Shakti Singh Rathore
 
PPTX
Operator Overloading and Scope of Variable
MOHIT DADU
 
DOCX
Python interview questions and answers
RojaPriya
 
PDF
Introduction to c++
Prof. Dr. K. Adisesha
 
PDF
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Codemotion
 
PDF
What is Python?
wesley chun
 
ODP
James Jesus Bermas on Crash Course on Python
CP-Union
 
PPTX
Python and You Series
Karthik Prakash
 
PPTX
Python Data-Types
Akhil Kaushik
 
PDF
Data file handling
Prof. Dr. K. Adisesha
 
PDF
Function overloading
Prof. Dr. K. Adisesha
 
PPTX
Python Basics by Akanksha Bali
Akanksha Bali
 
PPTX
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Maulik Borsaniya
 
DOCX
Python Interview Questions For Experienced
zynofustechnology
 
PDF
Consuming and Creating Libraries in C++
Richard Thomson
 
Python-01| Fundamentals
Mohd Sajjad
 
Python second ppt
RaginiJain21
 
Functions in Python
Shakti Singh Rathore
 
Operator Overloading and Scope of Variable
MOHIT DADU
 
Python interview questions and answers
RojaPriya
 
Introduction to c++
Prof. Dr. K. Adisesha
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Codemotion
 
What is Python?
wesley chun
 
James Jesus Bermas on Crash Course on Python
CP-Union
 
Python and You Series
Karthik Prakash
 
Python Data-Types
Akhil Kaushik
 
Data file handling
Prof. Dr. K. Adisesha
 
Function overloading
Prof. Dr. K. Adisesha
 
Python Basics by Akanksha Bali
Akanksha Bali
 
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Maulik Borsaniya
 
Python Interview Questions For Experienced
zynofustechnology
 
Consuming and Creating Libraries in C++
Richard Thomson
 
Ad

Viewers also liked (12)

PDF
Python Programming - IX. On Randomness
Ranel Padon
 
PDF
Python Programming - X. Exception Handling and Assertions
Ranel Padon
 
PDF
Python Programming - XI. String Manipulation and Regular Expressions
Ranel Padon
 
PDF
Python Programming - VIII. Inheritance and Polymorphism
Ranel Padon
 
PDF
Python Programming - III. Controlling the Flow
Ranel Padon
 
PDF
Python Programming - XIII. GUI Programming
Ranel Padon
 
PDF
Python Programming - VI. Classes and Objects
Ranel Padon
 
PDF
Python Programming - II. The Basics
Ranel Padon
 
PDF
Python Programming - V. Sequences (List and Tuples) and Dictionaries
Ranel Padon
 
PDF
Python Programming - VII. Customizing Classes and Operator Overloading
Ranel Padon
 
PDF
Switchable Map APIs with Drupal
Ranel Padon
 
PDF
Python Programming - I. Introduction
Ranel Padon
 
Python Programming - IX. On Randomness
Ranel Padon
 
Python Programming - X. Exception Handling and Assertions
Ranel Padon
 
Python Programming - XI. String Manipulation and Regular Expressions
Ranel Padon
 
Python Programming - VIII. Inheritance and Polymorphism
Ranel Padon
 
Python Programming - III. Controlling the Flow
Ranel Padon
 
Python Programming - XIII. GUI Programming
Ranel Padon
 
Python Programming - VI. Classes and Objects
Ranel Padon
 
Python Programming - II. The Basics
Ranel Padon
 
Python Programming - V. Sequences (List and Tuples) and Dictionaries
Ranel Padon
 
Python Programming - VII. Customizing Classes and Operator Overloading
Ranel Padon
 
Switchable Map APIs with Drupal
Ranel Padon
 
Python Programming - I. Introduction
Ranel Padon
 
Ad

Similar to Python Programming - XII. File Processing (20)

PPTX
file handling.pptx avlothaan pa thambi popa
senniyappanharish
 
PPTX
FILE HANDLING IN PYTHON Presentation Computer Science
HargunKaurGrover
 
PPTX
01 file handling for class use class pptx
PreeTVithule1
 
PPTX
FILE HANDLING in python to understand basic operations.
ssuser00ad4e
 
PPTX
File Handling in Python -binary files.pptx
deepa63690
 
PPTX
file handling in python using exception statement
srividhyaarajagopal
 
PDF
FileHandling2023_Text File.pdf CBSE 2014
JAYASURYANSHUPEDDAPA
 
PPTX
this is about file concepts in class 12 in python , text file, binary file, c...
Primary2Primary2
 
PPTX
for interview this ppt is a teching aid for file handling concepts includes t...
Primary2Primary2
 
PPTX
Binary File.pptx
MasterDarsh
 
PPTX
Python data file handling
ToniyaP1
 
PPTX
file handlling in python 23.12.24 geetha.pptx
vlkumashankardeekshi th
 
PDF
file handling.pdf
RonitVaskar2
 
PPT
File Handling Btech computer science and engineering ppt
pinuadarsh04
 
PDF
lecs102.pdf kjolholhkl';l;llkklkhjhjbhjjmnj
MrProfEsOr1
 
PDF
File handling with python class 12th .pdf
lionsconvent1234
 
PDF
File handling3 (1).pdf uhgipughserigrfiogrehpiuhnfi;reuge
vsol7206
 
PPTX
DFH PDF-converted.pptx
AmitKaur17
 
PPTX
CBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary file
ShivaniJayaprakash1
 
PPTX
Chapter 08 data file handling
Praveen M Jigajinni
 
file handling.pptx avlothaan pa thambi popa
senniyappanharish
 
FILE HANDLING IN PYTHON Presentation Computer Science
HargunKaurGrover
 
01 file handling for class use class pptx
PreeTVithule1
 
FILE HANDLING in python to understand basic operations.
ssuser00ad4e
 
File Handling in Python -binary files.pptx
deepa63690
 
file handling in python using exception statement
srividhyaarajagopal
 
FileHandling2023_Text File.pdf CBSE 2014
JAYASURYANSHUPEDDAPA
 
this is about file concepts in class 12 in python , text file, binary file, c...
Primary2Primary2
 
for interview this ppt is a teching aid for file handling concepts includes t...
Primary2Primary2
 
Binary File.pptx
MasterDarsh
 
Python data file handling
ToniyaP1
 
file handlling in python 23.12.24 geetha.pptx
vlkumashankardeekshi th
 
file handling.pdf
RonitVaskar2
 
File Handling Btech computer science and engineering ppt
pinuadarsh04
 
lecs102.pdf kjolholhkl';l;llkklkhjhjbhjjmnj
MrProfEsOr1
 
File handling with python class 12th .pdf
lionsconvent1234
 
File handling3 (1).pdf uhgipughserigrfiogrehpiuhnfi;reuge
vsol7206
 
DFH PDF-converted.pptx
AmitKaur17
 
CBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary file
ShivaniJayaprakash1
 
Chapter 08 data file handling
Praveen M Jigajinni
 

More from Ranel Padon (8)

PDF
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
Ranel Padon
 
PDF
CKEditor Widgets with Drupal
Ranel Padon
 
PDF
Views Unlimited: Unleashing the Power of Drupal's Views Module
Ranel Padon
 
PDF
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Ranel Padon
 
PDF
PyCon PH 2014 - GeoComputation
Ranel Padon
 
PDF
Power and Elegance - Leaflet + jQuery
Ranel Padon
 
PDF
Of Nodes and Maps (Web Mapping with Drupal - Part II)
Ranel Padon
 
PDF
Web Mapping with Drupal
Ranel Padon
 
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
Ranel Padon
 
CKEditor Widgets with Drupal
Ranel Padon
 
Views Unlimited: Unleashing the Power of Drupal's Views Module
Ranel Padon
 
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Ranel Padon
 
PyCon PH 2014 - GeoComputation
Ranel Padon
 
Power and Elegance - Leaflet + jQuery
Ranel Padon
 
Of Nodes and Maps (Web Mapping with Drupal - Part II)
Ranel Padon
 
Web Mapping with Drupal
Ranel Padon
 

Recently uploaded (20)

PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Coupa-Overview _Assumptions presentation
annapureddyn
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 

Python Programming - XII. File Processing

  • 1. XII. FILE PROCESSING Engr. Ranel O. Padon
  • 2. PYTHON PROGRAMMING TOPICS I • Introduction to Python Programming II • Python Basics III • Controlling the Program Flow IV • Program Components: Functions, Classes, Packages, and Modules V • Sequences (List and Tuples), and Dictionaries VI • Object-Based Programming: Classes and Objects VII • Customizing Classes and Operator Overloading VIII • Object-Oriented Programming: Inheritance and Polymorphism IX • Randomization Algorithms X • Exception Handling and Assertions XI • String Manipulation and Regular Expressions XII • File Handling and Processing XIII • GUI Programming Using Tkinter
  • 5. FILE HANDLING variables offer only temporary storage of data they are lost when they “goes out of scope” or when the program terminates
  • 6. FILE HANDLING files are used for long-term retention of large amounts of data, even after the program that created the data terminates. data maintained in files is called persistent data
  • 7. FILE HANDLING | Data Hierarchy Bit (“Binary digit”) => the smallest computer data item Bit is a digit that can assume one of two values
  • 8. FILE HANDLING | Data Hierarchy Programming with low-level bit formats is tedious & boring. use decimal digits, letters, and symbols instead.
  • 9. FILE HANDLING | Data Hierarchy Characters are made-up of digits, letters, and characters. Characters are represented as combination of bits (bytes).
  • 10. FILE HANDLING | Data Hierarchy
  • 11. FILE HANDLING | Data Hierarchy Field (Column) is a collection of characters, represented as words. Record (Row) is a collection of fields, represented as a tuple, dictionary, instance of a class. File (Table) is a collection of records, implemented as sequential access or random-access. Database (Folder) is a collection of files, handled by DBMS softwares.
  • 12. FILE HANDLING | Data Hierarchy
  • 13. FILE HANDLING | Data Hierarchy
  • 14. FILE HANDLING | open() & close() magical_file = open(“file_name.txt” [, a|r|r+|w|w+] [, buffer_mode]) magical_file.close()
  • 15. FILE HANDLING | Other Functions
  • 16. FILE HANDLING | open() Open Mode r r+ w w+ a a+ Read Write Appends Overwrites Creates Cursor @ Start Cursor @ EOF
  • 17. FILE HANDLING | Common Modes Open Mode r w Read Write Appends Overwrites Creates Cursor @ Start Cursor @ EOF
  • 18. FILE HANDLING | open() “r” is the default file-open mode open(“input.dat”) = open(“input.dat”, “r”)
  • 22. FILE HANDLING | w  try removing line #6  try removing "n" in lines #3 and #4
  • 24. FILE HANDLING | with-as Keyword
  • 25. FILE HANDLING | Parsing Paninda.txt
  • 26. FILE HANDLING | Parsing | split
  • 27. FILE HANDLING | Parsing | split
  • 28. FILE HANDLING | Parsing | csv Paranormal_Sightings.csv
  • 29. FILE HANDLING | Parsing | strip
  • 30. FILE HANDLING | Parsing | strip
  • 31. FILE HANDLING | Parsing & Classes
  • 32. FILE HANDLING | Parsing & Classes
  • 33. FILE HANDLING | Parsing & Classes
  • 34. FILE HANDLING | Parsing & Classes 2
  • 35. FILE HANDLING | Parsing & Classes 2
  • 36. FILE HANDLING | Parsing & Classes 2
  • 37. FILE HANDLING | Parsing & Classes 2
  • 38. FILE HANDLING | HTML Parsing MangJose.html
  • 39. FILE HANDLING | HTML Parsing MangJose.html
  • 40. FILE HANDLING | HTML Parsing
  • 41. FILE HANDLING | HTML Parsing
  • 42. FILE HANDLING | HTML Parsing
  • 43. FILE HANDLING | HTML Parsing
  • 44. FILE HANDLING | HTML Parsing
  • 45. FILE HANDLING | HTML Parsing
  • 46. FILE HANDLING | r+, w+, a+ All of the "plus" modes allow reading and writing: the main difference between them is where we're positioned in the file. “r+” puts us at the beginning “w+” puts us at the beginning & the end, because the file's truncated “a+” puts us at the end.
  • 48. FILE HANDLING | Buffering
  • 49. FILE HANDLING | Buffering “-1” is the default file-open buffering mode open(“input.dat”) = open(“input.dat”, “r”, “-1”) Flag Meaning 0 unbuffered 1 buffered line n buffered with size n -1 system default
  • 50. FILE HANDLING | Creating A Big File!
  • 51. FILE HANDLING | Unbuffered r Then, let’s read that big file. 
  • 52. FILE HANDLING | Buffered r Now, with the help of buffering. 
  • 53. FILE HANDLING | Buffered By Default In other languages, like C or Java, buffering is not the default mode.
  • 54. FILE HANDLING | What else? 1. Random-Access Files: for fast searching/editing of records * use the shelve module * shelve.open() 2. Serialization: compressing file as objects for efficiency; useful for transferring data (objects, sequences, etc) across a network connection or saving states of a game * use the pickle or cPickle module * cPickle.dump(stringList_to_be_written, serialized_file) * records = cPickle.load(serialized_file)
  • 59. PRACTICE EXERCISE| MORSE CODE A. Read a file containing Filipino/English-language phrases and encodes it into Morse code. B. Read a Morse code file and converts it into the Filipino/English-language equivalent. Use one blank between each Morse-coded letter and three blanks between each Morse-coded word.
  • 60. REFERENCES  Deitel, Deitel, Liperi, and Wiedermann - Python: How to Program (2001).  Disclaimer: Most of the images/information used here have no proper source citation, and I do not claim ownership of these either. I don’t want to reinvent the wheel, and I just want to reuse and reintegrate materials that I think are useful or cool, then present them in another light, form, or perspective. Moreover, the images/information here are mainly used for illustration/educational purposes only, in the spirit of openness of data, spreading light, and empowering people with knowledge. 