SlideShare a Scribd company logo
1 of 18
An Introduction To Software
Development Using Python
Spring Semester, 2014
Class #19:
Files, Part 1
Data, Data, Data
• In the real world, your program will need to process data. A
lot of data.
• In this class we’ve already used two different ways to get data
into your programs:
– You typed it in (“input”)
– It was given to you in the form of a list (patients)
• Now it’s time to deal with A LOT OF DATA.
• Say hello to files…
Image Credit: paulmjohnstone.wordpress.com
Opening Files: Reading
• To access a file, you must first open it.
• When you open a file, you give the name of the file, or, if the
file is stored in a different directory, the file name preceded
by the directory path.
• You also specify whether the file is to be opened for reading
or writing.
• Suppose you want to read data from a file named input.txt,
located in the same directory as the program. Then you use
the following function call to open the file:
infile = open("input.txt", "r")
Image Credit: www.clipartof.com
Opening Files: Writing
• This statement opens the file for reading (indicated by the
string argument "r") and returns a file object that is associated
with the file named input.txt.
• The file object returned by the open function must be saved
in a variable.
• All operations for accessing a file are made via the file object.
• To open a file for writing, you provide the name of the file as
the first argument to the open function and the string "w" as
the second argument:
outfile = open("output.txt", "w")
Image Credit: www.freepik.com
Closing A File
• If the output file already exists, it is emptied before the new data is
written into it.
• If the file does not exist, an empty file is created.
• When you are done processing a file, be sure to close the file using the
close method:
infile.close()
outfile.close()
• If your program exits without closing a file that was opened for writing,
some of the output may not be written to the disk file.
• After a file has been closed, it cannot be used again until it has been
reopened.
Image Credit: www.clipartpanda.com
Opening / Closing Files Syntax
Reading From A File
• To read a line of text from a file, call the readline method with
the file object that was returned when you opened the file:
line = infile.readline()
• When a file is opened, an input marker is positioned at the
beginning of the file.
• The readline method reads the text, starting at the current
position and continuing until the end of the line is
encountered.
• The input marker is then moved to the next line.
Image Credit: www.clipartpanda.com
Reading From A File
• The readline method returns the text that it read, including the newline
character that denotes the end of the line.
• For example, suppose input.txt contains the lines
flying
circus
• The first call to readline returns the string "flyingn".
• Recall that n denotes the newline character that indicates the end of the
line.
• If you call readline a second time, it returns the string "circusn".
• Calling readline again yields the empty string "" because you have reached
the end of the file. Image Credit: fanart.tv
Blank Lines
• If the file contains a blank line, then readline returns a string containing
only the newline character "n".
• Reading multiple lines of text from a file is very similar to reading a
sequence of values with the input function.
• You repeatedly read a line of text and process it until the sentinel value is
reached:
line = infile.readline()
while line != "" :
Process the line.
line = infile.readline()
• The sentinel value is an empty string, which is returned by the readline
method after the end of file has been reached.
Image Credit: all-free-download.com
What Are You Reading?
• As with the input function, the readline method can
only return strings.
• If the file contains numerical data, the strings must
be converted to the numerical value using the int or
float function:
value = float(line)
• Note that the newline character at the end of the
line is ignored when the string is converted to a
numerical value.
Image Credit: retroclipart.co
Writing To A File
• You can write text to a file that has been opened for writing.
This is done by applying the write method to the file object.
• For example, we can write the string "Hello, World!" to our
output file using the statement:
outfile.write("Hello, World!n")
• The print function adds a newline character at the end of
its output to start a new line.
• When writing text to an output file, however, you must
explicitly write the newline character to start a new line.
Image Credit: olddesignshop.com
Writing To A File
• The write method takes a single string as an argument and
writes the string immediately.
• That string is appended to the end of the file, following any
text previously written to the file.
• You can also write formatted strings to a file with the write
method:
outfile.write("Number of entries: %dnTotal: %8.2fn" %
(count, total))
Image Credit: www.freeclipartnow.com
Writing With The Print Statement
• Alternatively, you can write text to a file with the print
function.
• Supply the file object as an argument with name file, as
follows:
print("Hello, World!", file=outfile)
• If you don’t want a newline, use the end argument:
print("Total: ", end="", file=outfile)
Image Credit: www.artofmanliness.com
File I/O Example
• Suppose you are given a text file that contains a sequence of floating-point
values, stored one value per line. You need to read the values and write
them to a new output file, aligned in a column and followed by their total
and average value.
32.0
54.0
67.5
80.25
115.0
32.00
54.00
67.50
80.25
115.00
--------
Total: 348.75
Average: 69.75
Input File Output File
One Final Note: Backslashes
• When you specify a file name as a string literal, and the name
contains backslash characters (as in a Windows file name),
you must supply each backslash twice:
infile = open("c:homeworkinput.txt", "r")
• A single backslash inside a quoted string is an escape
character that is combined with the following character to
form a special meaning, such as n for a newline character.
• The  combination denotes a single backslash.
• When supplying a file name to a program, however, a
program user should not type the backslash twice.
Image Credit: www.pageresource.com
What’s In Your Python Toolbox?
print() math strings I/O IF/Else elif While For
Lists And/Or/Not Functions Files
What We Covered Today
1. Opening files
2. Reading from files
3. Writing to files
4. Closing files
Image Credit: http://www.tswdj.com/blog/2011/05/17/the-grooms-checklist/
What We’ll Be Covering Next Time
1. Files, Part 2
Image Credit: http://merchantblog.thefind.com/2011/01/merchant-newsletter/resolve-to-take-advantage-of-these-5-e-commerce-trends/attachment/crystal-ball-fullsize/

More Related Content

What's hot

Java input output package
Java input output packageJava input output package
Java input output package
Sujit Kumar
 
Byte stream classes.49
Byte stream classes.49Byte stream classes.49
Byte stream classes.49
myrajendra
 
Various io stream classes .47
Various io stream classes .47Various io stream classes .47
Various io stream classes .47
myrajendra
 

What's hot (19)

java.io - streams and files
java.io - streams and filesjava.io - streams and files
java.io - streams and files
 
JAVA
JAVAJAVA
JAVA
 
05io
05io05io
05io
 
File Handling in Java Oop presentation
File Handling in Java Oop presentationFile Handling in Java Oop presentation
File Handling in Java Oop presentation
 
CSV File Manipulation
CSV File ManipulationCSV File Manipulation
CSV File Manipulation
 
Input output streams
Input output streamsInput output streams
Input output streams
 
Java input output package
Java input output packageJava input output package
Java input output package
 
Java Input Output (java.io.*)
Java Input Output (java.io.*)Java Input Output (java.io.*)
Java Input Output (java.io.*)
 
python file handling
python file handlingpython file handling
python file handling
 
C# File IO Operations
C# File IO OperationsC# File IO Operations
C# File IO Operations
 
9 Inputs & Outputs
9 Inputs & Outputs9 Inputs & Outputs
9 Inputs & Outputs
 
Basic i/o & file handling in java
Basic i/o & file handling in javaBasic i/o & file handling in java
Basic i/o & file handling in java
 
Data file handling in python introduction,opening & closing files
Data file handling in python introduction,opening & closing filesData file handling in python introduction,opening & closing files
Data file handling in python introduction,opening & closing files
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streams
 
31cs
31cs31cs
31cs
 
Javaiostream
JavaiostreamJavaiostream
Javaiostream
 
Byte stream classes.49
Byte stream classes.49Byte stream classes.49
Byte stream classes.49
 
Java Streams
Java StreamsJava Streams
Java Streams
 
Various io stream classes .47
Various io stream classes .47Various io stream classes .47
Various io stream classes .47
 

Viewers also liked

Viewers also liked (16)

An Introduction To Python - Graphics
An Introduction To Python - GraphicsAn Introduction To Python - Graphics
An Introduction To Python - Graphics
 
An Introduction To Python - FOR Loop
An Introduction To Python - FOR LoopAn Introduction To Python - FOR Loop
An Introduction To Python - FOR Loop
 
An Introduction To Python - Nested Branches, Multiple Alternatives
An Introduction To Python - Nested Branches, Multiple AlternativesAn Introduction To Python - Nested Branches, Multiple Alternatives
An Introduction To Python - Nested Branches, Multiple Alternatives
 
An Introduction To Python - Tables, List Algorithms
An Introduction To Python - Tables, List AlgorithmsAn Introduction To Python - Tables, List Algorithms
An Introduction To Python - Tables, List Algorithms
 
An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1
 
An Introduction To Software Development - Architecture & Detailed Design
An Introduction To Software Development - Architecture & Detailed DesignAn Introduction To Software Development - Architecture & Detailed Design
An Introduction To Software Development - Architecture & Detailed Design
 
An Introduction To Python - Working With Data
An Introduction To Python - Working With DataAn Introduction To Python - Working With Data
An Introduction To Python - Working With Data
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
 
An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2
 
An Introduction To Python - WHILE Loop
An Introduction To  Python - WHILE LoopAn Introduction To  Python - WHILE Loop
An Introduction To Python - WHILE Loop
 
An Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathAn Introduction To Python - Variables, Math
An Introduction To Python - Variables, Math
 
An Introduction To Software Development - Software Support and Maintenance
An Introduction To Software Development - Software Support and MaintenanceAn Introduction To Software Development - Software Support and Maintenance
An Introduction To Software Development - Software Support and Maintenance
 
An Introduction To Python - Functions, Part 2
An Introduction To Python - Functions, Part 2An Introduction To Python - Functions, Part 2
An Introduction To Python - Functions, Part 2
 
An Introduction To Python - Dictionaries
An Introduction To Python - DictionariesAn Introduction To Python - Dictionaries
An Introduction To Python - Dictionaries
 
An Introduction To Software Development - Implementation
An Introduction To Software Development - ImplementationAn Introduction To Software Development - Implementation
An Introduction To Software Development - Implementation
 
An Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm ReviewAn Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm Review
 

Similar to An Introduction To Python - Files, Part 1

File Handling Topic for tech management you know na tho kyuon puch raha hai sale
File Handling Topic for tech management you know na tho kyuon puch raha hai saleFile Handling Topic for tech management you know na tho kyuon puch raha hai sale
File Handling Topic for tech management you know na tho kyuon puch raha hai sale
RohitKurdiya1
 

Similar to An Introduction To Python - Files, Part 1 (20)

ch09.ppt
ch09.pptch09.ppt
ch09.ppt
 
Python file handling
Python file handlingPython file handling
Python file handling
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
File Handling as 08032021 (1).ppt
File Handling as 08032021 (1).pptFile Handling as 08032021 (1).ppt
File Handling as 08032021 (1).ppt
 
Python-files
Python-filesPython-files
Python-files
 
IOStream.pptx
IOStream.pptxIOStream.pptx
IOStream.pptx
 
CHAPTER 2 - FILE HANDLING-txtfile.pdf is here
CHAPTER 2 - FILE HANDLING-txtfile.pdf is hereCHAPTER 2 - FILE HANDLING-txtfile.pdf is here
CHAPTER 2 - FILE HANDLING-txtfile.pdf is here
 
Python file handlings
Python file handlingsPython file handlings
Python file handlings
 
Files in Python.pptx
Files in Python.pptxFiles in Python.pptx
Files in Python.pptx
 
Files in Python.pptx
Files in Python.pptxFiles in Python.pptx
Files in Python.pptx
 
File handling
File handlingFile handling
File handling
 
Data file handling
Data file handlingData file handling
Data file handling
 
Module2-Files.pdf
Module2-Files.pdfModule2-Files.pdf
Module2-Files.pdf
 
CSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfCSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdf
 
03-01-File Handling.pdf
03-01-File Handling.pdf03-01-File Handling.pdf
03-01-File Handling.pdf
 
03-01-File Handling python.pptx
03-01-File Handling python.pptx03-01-File Handling python.pptx
03-01-File Handling python.pptx
 
Unit V.pptx
Unit V.pptxUnit V.pptx
Unit V.pptx
 
File Handling Python
File Handling PythonFile Handling Python
File Handling Python
 
File Handling Topic for tech management you know na tho kyuon puch raha hai sale
File Handling Topic for tech management you know na tho kyuon puch raha hai saleFile Handling Topic for tech management you know na tho kyuon puch raha hai sale
File Handling Topic for tech management you know na tho kyuon puch raha hai sale
 
Working with files (concepts/pseudocode/python)
Working with files (concepts/pseudocode/python)Working with files (concepts/pseudocode/python)
Working with files (concepts/pseudocode/python)
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

An Introduction To Python - Files, Part 1

  • 1. An Introduction To Software Development Using Python Spring Semester, 2014 Class #19: Files, Part 1
  • 2. Data, Data, Data • In the real world, your program will need to process data. A lot of data. • In this class we’ve already used two different ways to get data into your programs: – You typed it in (“input”) – It was given to you in the form of a list (patients) • Now it’s time to deal with A LOT OF DATA. • Say hello to files… Image Credit: paulmjohnstone.wordpress.com
  • 3. Opening Files: Reading • To access a file, you must first open it. • When you open a file, you give the name of the file, or, if the file is stored in a different directory, the file name preceded by the directory path. • You also specify whether the file is to be opened for reading or writing. • Suppose you want to read data from a file named input.txt, located in the same directory as the program. Then you use the following function call to open the file: infile = open("input.txt", "r") Image Credit: www.clipartof.com
  • 4. Opening Files: Writing • This statement opens the file for reading (indicated by the string argument "r") and returns a file object that is associated with the file named input.txt. • The file object returned by the open function must be saved in a variable. • All operations for accessing a file are made via the file object. • To open a file for writing, you provide the name of the file as the first argument to the open function and the string "w" as the second argument: outfile = open("output.txt", "w") Image Credit: www.freepik.com
  • 5. Closing A File • If the output file already exists, it is emptied before the new data is written into it. • If the file does not exist, an empty file is created. • When you are done processing a file, be sure to close the file using the close method: infile.close() outfile.close() • If your program exits without closing a file that was opened for writing, some of the output may not be written to the disk file. • After a file has been closed, it cannot be used again until it has been reopened. Image Credit: www.clipartpanda.com
  • 6. Opening / Closing Files Syntax
  • 7. Reading From A File • To read a line of text from a file, call the readline method with the file object that was returned when you opened the file: line = infile.readline() • When a file is opened, an input marker is positioned at the beginning of the file. • The readline method reads the text, starting at the current position and continuing until the end of the line is encountered. • The input marker is then moved to the next line. Image Credit: www.clipartpanda.com
  • 8. Reading From A File • The readline method returns the text that it read, including the newline character that denotes the end of the line. • For example, suppose input.txt contains the lines flying circus • The first call to readline returns the string "flyingn". • Recall that n denotes the newline character that indicates the end of the line. • If you call readline a second time, it returns the string "circusn". • Calling readline again yields the empty string "" because you have reached the end of the file. Image Credit: fanart.tv
  • 9. Blank Lines • If the file contains a blank line, then readline returns a string containing only the newline character "n". • Reading multiple lines of text from a file is very similar to reading a sequence of values with the input function. • You repeatedly read a line of text and process it until the sentinel value is reached: line = infile.readline() while line != "" : Process the line. line = infile.readline() • The sentinel value is an empty string, which is returned by the readline method after the end of file has been reached. Image Credit: all-free-download.com
  • 10. What Are You Reading? • As with the input function, the readline method can only return strings. • If the file contains numerical data, the strings must be converted to the numerical value using the int or float function: value = float(line) • Note that the newline character at the end of the line is ignored when the string is converted to a numerical value. Image Credit: retroclipart.co
  • 11. Writing To A File • You can write text to a file that has been opened for writing. This is done by applying the write method to the file object. • For example, we can write the string "Hello, World!" to our output file using the statement: outfile.write("Hello, World!n") • The print function adds a newline character at the end of its output to start a new line. • When writing text to an output file, however, you must explicitly write the newline character to start a new line. Image Credit: olddesignshop.com
  • 12. Writing To A File • The write method takes a single string as an argument and writes the string immediately. • That string is appended to the end of the file, following any text previously written to the file. • You can also write formatted strings to a file with the write method: outfile.write("Number of entries: %dnTotal: %8.2fn" % (count, total)) Image Credit: www.freeclipartnow.com
  • 13. Writing With The Print Statement • Alternatively, you can write text to a file with the print function. • Supply the file object as an argument with name file, as follows: print("Hello, World!", file=outfile) • If you don’t want a newline, use the end argument: print("Total: ", end="", file=outfile) Image Credit: www.artofmanliness.com
  • 14. File I/O Example • Suppose you are given a text file that contains a sequence of floating-point values, stored one value per line. You need to read the values and write them to a new output file, aligned in a column and followed by their total and average value. 32.0 54.0 67.5 80.25 115.0 32.00 54.00 67.50 80.25 115.00 -------- Total: 348.75 Average: 69.75 Input File Output File
  • 15. One Final Note: Backslashes • When you specify a file name as a string literal, and the name contains backslash characters (as in a Windows file name), you must supply each backslash twice: infile = open("c:homeworkinput.txt", "r") • A single backslash inside a quoted string is an escape character that is combined with the following character to form a special meaning, such as n for a newline character. • The combination denotes a single backslash. • When supplying a file name to a program, however, a program user should not type the backslash twice. Image Credit: www.pageresource.com
  • 16. What’s In Your Python Toolbox? print() math strings I/O IF/Else elif While For Lists And/Or/Not Functions Files
  • 17. What We Covered Today 1. Opening files 2. Reading from files 3. Writing to files 4. Closing files Image Credit: http://www.tswdj.com/blog/2011/05/17/the-grooms-checklist/
  • 18. What We’ll Be Covering Next Time 1. Files, Part 2 Image Credit: http://merchantblog.thefind.com/2011/01/merchant-newsletter/resolve-to-take-advantage-of-these-5-e-commerce-trends/attachment/crystal-ball-fullsize/

Editor's Notes

  1. New name for the class I know what this means Technical professionals are who get hired This means much more than just having a narrow vertical knowledge of some subject area. It means that you know how to produce an outcome that I value. I’m willing to pay you to do that.